Construct FunctionEmpty

Performance Diagrams

Construct FunctionEmpty 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)2903623988.95192307692307257.0CPython 2.72950120242.31730769230768479.0081371353808Nuitka (master)2950000395.6826923076923479.0091584055995Nuitka (develop)2950078549.0480769230769479.00849457995736Nuitka (factory)Construct FunctionEmptyTicks Construct FunctionEmpty 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2941412088.95192307692307257.0CPython 3.55350646242.31730769230768459.1632682770148Nuitka (master)5348842395.6826923076923459.1784241325647Nuitka (develop)5349956549.0480769230769459.16906513972515Nuitka (factory)Construct FunctionEmptyTicks

Source Code with Construct

def empty():
    pass

module_var = None

def calledRepeatedly():
    # We measure making that call or not. Lets get the module
    # variable look-up out of the game, by making it a local
    # variable
    called = empty

# construct_begin
    called()
# construct_end

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

def empty():
    pass

module_var = None

def calledRepeatedly():
    # We measure making that call or not. Lets get the module
    # variable look-up out of the game, by making it a local
    # variable
    called = empty

# construct_begin



import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
29     # variable look-up out of the game, by making it a local 29     # variable look-up out of the game, by making it a local
30     # variable 30     # variable
31     called = empty 31     called = empty
32 32
33 # construct_begin 33 # construct_begin
t 34     called() t 34  
35 # construct_end 35  
36 36
37 import itertools 37 import itertools
38 for x in itertools.repeat(None, 50000): 38 for x in itertools.repeat(None, 50000):
39     calledRepeatedly() 39     calledRepeatedly()
40 40

Context Diff of Generated Code


Construct
Baseline
165     PyObject *exception_keeper_type_1; 165     PyObject *exception_keeper_type_1;
166     PyObject *exception_keeper_value_1; 166     PyObject *exception_keeper_value_1;
167     PyTracebackObject *exception_keeper_tb_1; 167     PyTracebackObject *exception_keeper_tb_1;
168     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 168     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
169     PyObject *tmp_assign_source_1; 169     PyObject *tmp_assign_source_1;
n 170     PyObject *tmp_called_name_1; n
171     PyObject *tmp_return_value; 170     PyObject *tmp_return_value;
n 172     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
173     static struct Nuitka_FrameObject *cache_frame_57c5489edbb934f9d588c59e0d326cdf = NULL; 171     static struct Nuitka_FrameObject *cache_frame_57c5489edbb934f9d588c59e0d326cdf = NULL;
174 172
175     struct Nuitka_FrameObject *frame_57c5489edbb934f9d588c59e0d326cdf; 173     struct Nuitka_FrameObject *frame_57c5489edbb934f9d588c59e0d326cdf;
176 174
177     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 175     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
213 211
214     assert( var_called == NULL ); 212     assert( var_called == NULL );
215     Py_INCREF( tmp_assign_source_1 ); 213     Py_INCREF( tmp_assign_source_1 );
216     var_called = tmp_assign_source_1; 214     var_called = tmp_assign_source_1;
217 215
n 218     tmp_called_name_1 = var_called; n
219  
220     CHECK_OBJECT( tmp_called_name_1 );
221     frame_57c5489edbb934f9d588c59e0d326cdf->m_frame.f_lineno = 34;
222     tmp_unused = CALL_FUNCTION_NO_ARGS( tmp_called_name_1 );
223     if ( tmp_unused == NULL )
224     {
225         assert( ERROR_OCCURRED() );
226  
227         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
228  
229  
230         exception_lineno = 34;
231         type_description_1 = "o";
232         goto frame_exception_exit_1;
233     }
234     Py_DECREF( tmp_unused );
235 216
236 #if 0 217 #if 0
237     RESTORE_FRAME_EXCEPTION( frame_57c5489edbb934f9d588c59e0d326cdf ); 218     RESTORE_FRAME_EXCEPTION( frame_57c5489edbb934f9d588c59e0d326cdf );
238 #endif 219 #endif
239 220
288     // tried codes exits in all cases 269     // tried codes exits in all cases
289     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly ); 270     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly );
290     return NULL; 271     return NULL;
291     // Return handler code: 272     // Return handler code:
292     try_return_handler_1:; 273     try_return_handler_1:;
n n 274     CHECK_OBJECT( (PyObject *)var_called );
293     Py_XDECREF( var_called ); 275     Py_DECREF( var_called );
294     var_called = NULL; 276     var_called = NULL;
295 277
296     goto function_return_exit; 278     goto function_return_exit;
297     // Exception handler code: 279     // Exception handler code:
298     try_except_handler_1:; 280     try_except_handler_1:;
302     exception_keeper_lineno_1 = exception_lineno; 284     exception_keeper_lineno_1 = exception_lineno;
303     exception_type = NULL; 285     exception_type = NULL;
304     exception_value = NULL; 286     exception_value = NULL;
305     exception_tb = NULL; 287     exception_tb = NULL;
306     exception_lineno = 0; 288     exception_lineno = 0;
t 307   t
308     Py_XDECREF( var_called );
309     var_called = NULL;
310 289
311     // Re-raise. 290     // Re-raise.
312     exception_type = exception_keeper_type_1; 291     exception_type = exception_keeper_type_1;
313     exception_value = exception_keeper_value_1; 292     exception_value = exception_keeper_value_1;
314     exception_tb = exception_keeper_tb_1; 293     exception_tb = exception_keeper_tb_1;