Construct CallLambdaExpressionDirectly

Performance Diagrams

Construct CallLambdaExpressionDirectly 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)4821151373.61538461538461257.0CPython 2.718752452196.30769230769232407.9968622935164Nuitka (historic)100075319.0000000000001503.602435102363Nuitka (master)99648441.69230769230774503.6046237552939Nuitka (develop)99884564.3846153846155503.60341410168337Nuitka (factory)Construct CallLambdaExpressionDirectlyTicks Construct CallLambdaExpressionDirectly 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)5931214473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)103779319.0000000000001503.68300457024577Nuitka (master)108168441.69230769230774503.6647184428201Nuitka (develop)99971564.3846153846155503.69887004603464Nuitka (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
95     codeobj_main = codeobj_badb6e9c31696fd59fbf4ee5e3038af0; 95     codeobj_main = codeobj_badb6e9c31696fd59fbf4ee5e3038af0;
96     codeobj_683b47c0b6f37f3ae97d65aa6d88578a = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE ); 96     codeobj_683b47c0b6f37f3ae97d65aa6d88578a = MAKE_CODEOBJ( module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE );
97 } 97 }
98 98
99 // The module function declarations. 99 // The module function declarations.
n 100 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( PyObject **python_pars ); n
101  
102  
103 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  ); 100 static PyObject *MAKE_FUNCTION___main__$$$function_1_calledRepeatedly(  );
104 101
105 102
106 // The module function definitions. 103 // The module function definitions.
107 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars ) 104 static PyObject *impl___main__$$$function_1_calledRepeatedly( struct Nuitka_FunctionObject const *self, PyObject **python_pars )
110 #ifndef __NUITKA_NO_ASSERT__ 107 #ifndef __NUITKA_NO_ASSERT__
111     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED(); 108     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
112 #endif 109 #endif
113 110
114     // Local variable declarations. 111     // Local variable declarations.
n 115     PyObject *tmp_dircall_arg1_1; n
116     PyObject *tmp_return_value; 112     PyObject *tmp_return_value;
117     tmp_return_value = NULL; 113     tmp_return_value = NULL;
118 114
119     // Actual function code. 115     // Actual function code.
n 120     tmp_dircall_arg1_1 = const_int_pos_7; n 116     tmp_return_value = const_int_pos_7;
121     Py_INCREF( tmp_dircall_arg1_1 ); 117     Py_INCREF( tmp_return_value );
122  
123     {
124         PyObject *dir_call_args[] = {tmp_dircall_arg1_1};
125         tmp_return_value = impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( dir_call_args );
126     }
127     assert( tmp_return_value != NULL );
128     goto function_return_exit; 118     goto function_return_exit;
129 119
130     // Return statement must have exited already. 120     // Return statement must have exited already.
131     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 121     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
t 132     return NULL; t
133  
134     function_return_exit:
135  
136     CHECK_OBJECT( tmp_return_value );
137     assert( had_error || !ERROR_OCCURRED() );
138     return tmp_return_value;
139  
140 }
141  
142  
143 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda( PyObject **python_pars )
144 {
145 #ifndef __NUITKA_NO_ASSERT__
146     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
147     assert(!had_error); // Do not enter inlined functions with error set.
148 #endif
149  
150     // Local variable declarations.
151     PyObject *par_x = python_pars[ 0 ];
152     PyObject *tmp_return_value;
153     tmp_return_value = NULL;
154  
155     // Actual function code.
156     // Tried code:
157     tmp_return_value = par_x;
158  
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; 122     return NULL;
176 123
177     function_return_exit: 124     function_return_exit:
178 125
179     CHECK_OBJECT( tmp_return_value ); 126     CHECK_OBJECT( tmp_return_value );