Construct CallLambdaExpressionDirectly

Performance Diagrams

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