Construct CallLambdaExpressionDirectly

Performance Diagrams

Construct CallLambdaExpressionDirectly 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)5152520888.95192307692307257.0CPython 2.799910242.31730769230768503.636215310975Nuitka (master)99946395.6826923076923503.6360426546347Nuitka (develop)99910549.0480769230769503.636215310975Nuitka (factory)Construct CallLambdaExpressionDirectlyTicks Construct CallLambdaExpressionDirectly 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5905640788.95192307692307257.0CPython 3.5101510242.31730769230768503.6906265922237Nuitka (master)98124395.6826923076923503.70479495658606Nuitka (develop)104550549.0480769230769503.6779060288269Nuitka (factory)Construct CallLambdaExpressionDirectlyTicks

Source Code with Construct

from __future__ import print_function

def calledRepeatedly():
# construct_begin
    return (lambda x : x)(7)
# construct_alternative



import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

from __future__ import print_function

def calledRepeatedly():
# construct_begin

# construct_alternative
    return 7
# construct_end

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
19 # 19 #
20 from __future__ import print_function 20 from __future__ import print_function
21 21
22 def calledRepeatedly(): 22 def calledRepeatedly():
23 # construct_begin 23 # construct_begin
n 24     return (lambda x : x)(7) n 24  
25 # construct_alternative 25 # construct_alternative
t 26   t 26     return 7
27   27 # construct_end
28 28
29 import itertools 29 import itertools
30 for x in itertools.repeat(None, 50000): 30 for x in itertools.repeat(None, 50000):
31     calledRepeatedly() 31     calledRepeatedly()
32 32

Context Diff of Generated Code


Construct
Baseline
103     codeobj_main = codeobj_62e3a7e68562e2571d4afb7080d51afe; 103     codeobj_main = codeobj_62e3a7e68562e2571d4afb7080d51afe;
104     codeobj_3ec81d44d8bfc80d976377e7d527e862 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 104     codeobj_3ec81d44d8bfc80d976377e7d527e862 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
105 } 105 }
106 106
107 // The module function declarations. 107 // The module function declarations.
n 108 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( PyObject **python_pars ); n
109  
110  
111 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 108 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
112 109
113 110
114 // The module function definitions. 111 // The module function definitions.
115 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 112 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
121 118
122     // Local variable declarations. 119     // Local variable declarations.
123     PyObject *tmp_return_value = NULL; 120     PyObject *tmp_return_value = NULL;
124 121
125     // Actual function body. 122     // Actual function body.
n 126     { n 123     tmp_return_value = const_int_pos_7;
127         PyObject *tmp_dircall_arg1_1; 124     Py_INCREF( tmp_return_value );
128         tmp_dircall_arg1_1 = const_int_pos_7;
129         Py_INCREF( tmp_dircall_arg1_1 );
130  
131         {
132             PyObject *dir_call_args[] = {tmp_dircall_arg1_1};
133             tmp_return_value = impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( dir_call_args );
134         }
135         assert( !(tmp_return_value == NULL) );
136         goto function_return_exit; 125     goto function_return_exit;
137     }
138 126
139     // Return statement must have exited already. 127     // Return statement must have exited already.
140     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 128     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
t 141     return NULL; t
142  
143  
144 function_return_exit:
145    // Function cleanup code if any.
146  
147  
148    // Actual function exit with return value, making sure we did not make
149    // the error status worse despite non-NULL return.
150    CHECK_OBJECT( tmp_return_value );
151    assert( had_error || !ERROR_OCCURRED() );
152    return tmp_return_value;
153 }
154  
155  
156 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( PyObject **python_pars )
157 {
158 #ifndef __NUITKA_NO_ASSERT__
159     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
160     assert(!had_error); // Do not enter inlined functions with error set.
161 #endif
162  
163     // Local variable declarations.
164     PyObject *par_x = python_pars[ 0 ];
165     PyObject *tmp_return_value = NULL;
166  
167     // Actual function body.
168     // Tried code:
169     CHECK_OBJECT( par_x );
170     tmp_return_value = par_x;
171     Py_INCREF( tmp_return_value );
172     goto try_return_handler_1;
173     // tried codes exits in all cases
174     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_lambda );
175     return NULL;
176     // Return handler code:
177     try_return_handler_1:;
178     CHECK_OBJECT( (PyObject *)par_x );
179     Py_DECREF( par_x );
180     par_x = NULL;
181  
182     goto function_return_exit;
183     // End of try:
184  
185     // Return statement must have exited already.
186     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_lambda );
187     return NULL; 129     return NULL;
188 130
189 131
190 function_return_exit: 132 function_return_exit:
191    // Function cleanup code if any. 133    // Function cleanup code if any.