Construct CallLambdaExpressionDirectly

Performance Diagrams

Construct CallLambdaExpressionDirectly 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)5227523788.95192307692307257.0CPython 2.799988242.31730769230768503.64272156314587Nuitka (master)99964395.6826923076923503.64283501589273Nuitka (develop)99958549.0480769230769503.6428633790795Nuitka (factory)Construct CallLambdaExpressionDirectlyTicks Construct CallLambdaExpressionDirectly 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5875518588.95192307692307257.0CPython 3.5100051242.31730769230768503.69458530471695Nuitka (master)100223395.6826923076923503.6938618988396Nuitka (develop)100407549.0480769230769503.69308802278476Nuitka (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
100     codeobj_main = codeobj_33f20a1dda3ba10283dfde153f4472ac; 100     codeobj_main = codeobj_33f20a1dda3ba10283dfde153f4472ac;
101     codeobj_fdb968befd81a75def3d9c4aeff8f706 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 101     codeobj_fdb968befd81a75def3d9c4aeff8f706 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
102 } 102 }
103 103
104 // The module function declarations. 104 // The module function declarations.
n 105 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( PyObject **python_pars ); n
106  
107  
108 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 105 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
109 106
110 107
111 // The module function definitions. 108 // The module function definitions.
112 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 109 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
119     // Local variable declarations. 116     // Local variable declarations.
120     PyObject *tmp_return_value = NULL; 117     PyObject *tmp_return_value = NULL;
121 118
122     // Actual function code. 119     // Actual function code.
123     { 120     {
n 124     PyObject *tmp_dircall_arg1_1; n
125     tmp_dircall_arg1_1 = const_int_pos_7; 121     tmp_return_value = const_int_pos_7;
126     Py_INCREF( tmp_dircall_arg1_1 ); 122     Py_INCREF( tmp_return_value );
127  
128     {
129         PyObject *dir_call_args[] = {tmp_dircall_arg1_1};
130         tmp_return_value = impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( dir_call_args );
131     }
132     assert( !(tmp_return_value == NULL) );
133     goto function_return_exit; 123     goto function_return_exit;
134     } 124     }
135 125
136     // Return statement must have exited already. 126     // Return statement must have exited already.
137     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 127     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
t 138     return NULL; t
139  
140 function_return_exit:
141  
142 CHECK_OBJECT( tmp_return_value );
143 assert( had_error || !ERROR_OCCURRED() );
144 return tmp_return_value;
145  
146 }
147  
148  
149 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( PyObject **python_pars )
150 {
151 #ifndef __NUITKA_NO_ASSERT__
152     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
153     assert(!had_error); // Do not enter inlined functions with error set.
154 #endif
155  
156     // Local variable declarations.
157     PyObject *par_x = python_pars[ 0 ];
158     PyObject *tmp_return_value = NULL;
159  
160     // Actual function code.
161     {
162     // Tried code:
163     {
164     tmp_return_value = par_x;
165  
166     CHECK_OBJECT( tmp_return_value );
167     Py_INCREF( tmp_return_value );
168     goto try_return_handler_1;
169     }
170     // tried codes exits in all cases
171     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_lambda );
172     return NULL;
173     // Return handler code:
174     try_return_handler_1:;
175     {
176     CHECK_OBJECT( (PyObject *)par_x );
177     Py_DECREF( par_x );
178     par_x = NULL;
179  
180     }
181     {
182     goto function_return_exit;
183     }
184     // End of try:
185     }
186  
187     // Return statement must have exited already.
188     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_lambda );
189     return NULL; 128     return NULL;
190 129
191 function_return_exit: 130 function_return_exit:
192 131
193 CHECK_OBJECT( tmp_return_value ); 132 CHECK_OBJECT( tmp_return_value );