Construct CallLambdaExpressionDirectly

Performance Diagrams

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