Construct CallLambdaExpressionDirectly

Performance Diagrams

Construct CallLambdaExpressionDirectly 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)5227523788.95192307692307257.0CPython 2.7100108242.31730769230768503.6421542994116Nuitka (master)100096395.6826923076923503.642211025785Nuitka (develop)99820549.0480769230769503.643515732374Nuitka (factory)Construct CallLambdaExpressionDirectlyTicks Construct CallLambdaExpressionDirectly 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5875518588.95192307692307257.0CPython 3.5102999242.31730769230768503.682186464447Nuitka (master)103709395.6826923076923503.6792003122788Nuitka (develop)95965549.0480769230769503.7117704001521Nuitka (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_b9b656085796ca30867f349996e7e066; 100     codeobj_main = codeobj_b9b656085796ca30867f349996e7e066;
101     codeobj_5c2a100a715532a654d7e58a352c0c36 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 101     codeobj_5c2a100a715532a654d7e58a352c0c36 = 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     CHECK_OBJECT( par_x );
165     tmp_return_value = par_x;
166     Py_INCREF( tmp_return_value );
167     goto try_return_handler_1;
168     }
169     // tried codes exits in all cases
170     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_lambda );
171     return NULL;
172     // Return handler code:
173     try_return_handler_1:;
174     {
175     CHECK_OBJECT( (PyObject *)par_x );
176     Py_DECREF( par_x );
177     par_x = NULL;
178  
179     }
180     {
181     goto function_return_exit;
182     }
183     // End of try:
184     }
185  
186     // Return statement must have exited already.
187     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_lambda );
188     return NULL; 128     return NULL;
189 129
190 function_return_exit: 130 function_return_exit:
191 131
192 CHECK_OBJECT( tmp_return_value ); 132 CHECK_OBJECT( tmp_return_value );