Construct CallLambdaExpressionDirectly

Performance Diagrams

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