Construct CallLambdaExpressionDirectly

Performance Diagrams

Construct CallLambdaExpressionDirectly 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)4821151373.61538461538461257.0CPython 2.718752452196.30769230769232407.9968622935164Nuitka (historic)100081319.0000000000001503.60240434845764Nuitka (master)100529441.69230769230774503.60010805685806Nuitka (develop)100560564.3846153846155503.59994916168034Nuitka (factory)Construct CallLambdaExpressionDirectlyTicks Construct CallLambdaExpressionDirectly 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)5931214473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)84468319.0000000000001503.76346103110666Nuitka (master)110438441.69230769230774503.65526081938503Nuitka (develop)114098564.3846153846155503.64001196397874Nuitka (factory)Construct CallLambdaExpressionDirectlyTicks

Source Code with Construct

from __future__ import print_function

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



for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

from __future__ import print_function

def calledRepeatedly():
# construct_begin

# construct_alternative
    return 7
# construct_end

for x in xrange(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 for x in xrange(50000): 29 for x in xrange(50000):
30     calledRepeatedly() 30     calledRepeatedly()
31 31
32 print("OK.") 32 print("OK.")

Context Diff of Generated Code


Construct
Baseline
94     codeobj_main = codeobj_2d4ff2aa62992518f2e2babbc21c410d; 94     codeobj_main = codeobj_2d4ff2aa62992518f2e2babbc21c410d;
95     codeobj_727126b97ddfc280ce30c24c4cccf2c8 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 95     codeobj_727126b97ddfc280ce30c24c4cccf2c8 = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
96 } 96 }
97 97
98 // The module function declarations. 98 // The module function declarations.
n 99 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( PyObject **python_pars ); n
100  
101  
102 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 99 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
103 100
104 101
105 // The module function definitions. 102 // The module function definitions.
106 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 103 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
109 #ifndef __NUITKA_NO_ASSERT__ 106 #ifndef __NUITKA_NO_ASSERT__
110     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED(); 107     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
111 #endif 108 #endif
112 109
113     // Local variable declarations. 110     // Local variable declarations.
n 114     PyObject *tmp_dircall_arg1_1; n
115     PyObject *tmp_return_value; 111     PyObject *tmp_return_value;
116     tmp_return_value = NULL; 112     tmp_return_value = NULL;
117 113
118     // Actual function code. 114     // Actual function code.
n 119     tmp_dircall_arg1_1 = const_int_pos_7; n 115     tmp_return_value = const_int_pos_7;
120     Py_INCREF( tmp_dircall_arg1_1 ); 116     Py_INCREF( tmp_return_value );
121  
122     {
123         PyObject *dir_call_args[] = {tmp_dircall_arg1_1};
124         tmp_return_value = impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( dir_call_args );
125     }
126     assert( tmp_return_value != NULL );
127     goto function_return_exit; 117     goto function_return_exit;
128 118
129     // Return statement must have exited already. 119     // Return statement must have exited already.
130     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 120     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
t 131     return NULL; t
132  
133     function_return_exit:
134  
135     CHECK_OBJECT( tmp_return_value );
136     assert( had_error || !ERROR_OCCURRED() );
137     return tmp_return_value;
138  
139 }
140  
141  
142 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( PyObject **python_pars )
143 {
144 #ifndef __NUITKA_NO_ASSERT__
145     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
146     assert(!had_error); // Do not enter inlined functions with error set.
147 #endif
148  
149     // Local variable declarations.
150     PyObject *par_x = python_pars[ 0 ];
151     PyObject *tmp_return_value;
152     tmp_return_value = NULL;
153  
154     // Actual function code.
155     // Tried code:
156     tmp_return_value = par_x;
157  
158     CHECK_OBJECT( tmp_return_value );
159     Py_INCREF( tmp_return_value );
160     goto try_return_handler_1;
161     // tried codes exits in all cases
162     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_lambda );
163     return NULL;
164     // Return handler code:
165     try_return_handler_1:;
166     CHECK_OBJECT( (PyObject *)par_x );
167     Py_DECREF( par_x );
168     par_x = NULL;
169  
170     goto function_return_exit;
171     // End of try:
172  
173     // Return statement must have exited already.
174     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly$$$function_1_lambda );
175     return NULL; 121     return NULL;
176 122
177     function_return_exit: 123     function_return_exit:
178 124
179     CHECK_OBJECT( tmp_return_value ); 125     CHECK_OBJECT( tmp_return_value );