Construct CallLambdaExpressionDirectly

Performance Diagrams

Construct CallLambdaExpressionDirectly 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4687393288.95192307692307257.0CPython 2.7100024242.31730769230768503.58806659071433Nuitka (master)99988395.6826923076923503.5882563796539Nuitka (develop)100000549.0480769230769503.588193116674Nuitka (factory)Construct CallLambdaExpressionDirectlyTicks Construct CallLambdaExpressionDirectly 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)5835713788.95192307692307257.0CPython 3.5100038242.31730769230768503.69177012507555Nuitka (master)99988395.6826923076923503.6919818518645Nuitka (develop)99954549.0480769230769503.692125826081Nuitka (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_cd3bfdcf42affb90478c6797f7f0d5b7 = MAKE_CODEOBJ(module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE); 101     codeobj_cd3bfdcf42affb90478c6797f7f0d5b7 = MAKE_CODEOBJ(module_filename_obj, const_str_angle_module, 1, const_tuple_empty, 0, 0, CO_NOFREE);
102     codeobj_92a3fdec9337fc59a21451d9f08cb38f = MAKE_CODEOBJ(module_filename_obj, const_str_plain_calledRepeatedly, 22, const_tuple_empty, 0, 0, CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE); 102     codeobj_92a3fdec9337fc59a21451d9f08cb38f = 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) {
118 115
119     // Local variable declarations. 116     // Local variable declarations.
120     PyObject *tmp_return_value = NULL; 117     PyObject *tmp_return_value = NULL;
121 118
122     // Actual function body. 119     // Actual function body.
n 123     { n 120     tmp_return_value = const_int_pos_7;
124         PyObject *tmp_dircall_arg1_1; 121     Py_INCREF(tmp_return_value);
125         tmp_dircall_arg1_1 = const_int_pos_7;
126         Py_INCREF(tmp_dircall_arg1_1);
127  
128         {
129             PyObject *dir_call_args[] = {tmp_dircall_arg1_1};
130             tmp_return_value = impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda(dir_call_args);
131         }
132         assert(!(tmp_return_value == NULL));
133         goto function_return_exit; 122     goto function_return_exit;
134     }
135 123
136     // Return statement must have exited already. 124     // Return statement must have exited already.
137     NUITKA_CANNOT_GET_HERE(__main__$$$function_1_calledRepeatedly); 125     NUITKA_CANNOT_GET_HERE(__main__$$$function_1_calledRepeatedly);
138     return NULL; 126     return NULL;
139 127
140 128
141 function_return_exit: 129 function_return_exit:
142    // Function cleanup code if any. 130    // Function cleanup code if any.
143 131
t 144   t
145    // Actual function exit with return value, making sure we did not make
146    // the error status worse despite non-NULL return.
147    CHECK_OBJECT(tmp_return_value);
148    assert(had_error || !ERROR_OCCURRED());
149    return tmp_return_value;
150 }
151  
152  
153 NUITKA_LOCAL_MODULE PyObject *impl___main__$$$function_1_calledRepeatedly$$$function_1_lambda(PyObject **python_pars) {
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 = NULL;
162  
163     // Actual function body.
164     CHECK_OBJECT(par_x);
165     tmp_return_value = par_x;
166     Py_INCREF(tmp_return_value);
167     goto function_return_exit;
168  
169     // Return statement must have exited already.
170     NUITKA_CANNOT_GET_HERE(__main__$$$function_1_calledRepeatedly$$$function_1_lambda);
171     return NULL;
172  
173  
174 function_return_exit:
175    // Function cleanup code if any.
176     CHECK_OBJECT(par_x);
177     Py_DECREF(par_x);
178 132
179    // Actual function exit with return value, making sure we did not make 133    // Actual function exit with return value, making sure we did not make
180    // the error status worse despite non-NULL return. 134    // the error status worse despite non-NULL return.
181    CHECK_OBJECT(tmp_return_value); 135    CHECK_OBJECT(tmp_return_value);
182    assert(had_error || !ERROR_OCCURRED()); 136    assert(had_error || !ERROR_OCCURRED());