Construct OperationIntegerAdd

Performance Diagrams

Construct OperationIntegerAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1008115188.95192307692307257.0CPython 2.73449940242.31730769230768419.54832972254553Nuitka (master)3450006395.6826923076923419.5467118898809Nuitka (develop)3450024549.0480769230769419.54627066279056Nuitka (factory)Construct OperationIntegerAddTicks Construct OperationIntegerAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1672751788.95192307692307257.0CPython 3.510055736242.31730769230768355.5621313602381Nuitka (master)10054216395.6826923076923355.58458629988127Nuitka (develop)10056050549.0480769230769355.5574926424433Nuitka (factory)Construct OperationIntegerAddTicks

Source Code with Construct

module_value1 = 5000
module_value2 = 3000

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1

    s = module_value1
    t = module_value2
# construct_begin
    t = s + t
# construct_end

    return s, t, local_value

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

print("OK.")

Source Code without Construct

module_value1 = 5000
module_value2 = 3000

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1

    s = module_value1
    t = module_value2
# construct_begin



    return s, t, local_value

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

print("OK.")

Context Diff of Source Code


Construct
Baseline
28     local_value = module_value1 28     local_value = module_value1
29 29
30     s = module_value1 30     s = module_value1
31     t = module_value2 31     t = module_value2
32 # construct_begin 32 # construct_begin
t 33     t = s + t t 33  
34 # construct_end 34  
35 35
36     return s, t, local_value 36     return s, t, local_value
37 37
38 import itertools 38 import itertools
39 for x in itertools.repeat(None, 50000): 39 for x in itertools.repeat(None, 50000):

Context Diff of Generated Code


Construct
Baseline
145     PyTracebackObject *exception_keeper_tb_1; 145     PyTracebackObject *exception_keeper_tb_1;
146     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 146     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
147     PyObject *tmp_assign_source_1; 147     PyObject *tmp_assign_source_1;
148     PyObject *tmp_assign_source_2; 148     PyObject *tmp_assign_source_2;
149     PyObject *tmp_assign_source_3; 149     PyObject *tmp_assign_source_3;
n 150     PyObject *tmp_assign_source_4; n
151     PyObject *tmp_left_name_1;
152     PyObject *tmp_return_value; 150     PyObject *tmp_return_value;
n 153     PyObject *tmp_right_name_1; n
154     PyObject *tmp_tuple_element_1; 151     PyObject *tmp_tuple_element_1;
155     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 152     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
156     static struct Nuitka_FrameObject *cache_frame_cf843eab34e3f3f0ba22e6625b6aa386 = NULL; 153     static struct Nuitka_FrameObject *cache_frame_cf843eab34e3f3f0ba22e6625b6aa386 = NULL;
157 154
158     struct Nuitka_FrameObject *frame_cf843eab34e3f3f0ba22e6625b6aa386; 155     struct Nuitka_FrameObject *frame_cf843eab34e3f3f0ba22e6625b6aa386;
270 267
271     assert( var_t == NULL ); 268     assert( var_t == NULL );
272     Py_INCREF( tmp_assign_source_3 ); 269     Py_INCREF( tmp_assign_source_3 );
273     var_t = tmp_assign_source_3; 270     var_t = tmp_assign_source_3;
274 271
n 275     tmp_left_name_1 = var_s; n
276  
277     CHECK_OBJECT( tmp_left_name_1 );
278     tmp_right_name_1 = var_t;
279  
280     CHECK_OBJECT( tmp_right_name_1 );
281     tmp_assign_source_4 = BINARY_OPERATION_ADD( tmp_left_name_1, tmp_right_name_1 );
282     if ( tmp_assign_source_4 == NULL )
283     {
284         assert( ERROR_OCCURRED() );
285  
286         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
287  
288  
289         exception_lineno = 33;
290         type_description_1 = "ooo";
291         goto frame_exception_exit_1;
292     }
293     {
294         PyObject *old = var_t;
295         var_t = tmp_assign_source_4;
296         Py_XDECREF( old );
297     }
298  
299     tmp_return_value = PyTuple_New( 3 );
300     tmp_tuple_element_1 = var_s;
301  
302     if ( tmp_tuple_element_1 == NULL )
303     {
304         Py_DECREF( tmp_return_value );
305         exception_type = PyExc_UnboundLocalError;
306         Py_INCREF( exception_type );
307         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
308         exception_tb = NULL;
309         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
310         CHAIN_EXCEPTION( exception_value );
311  
312         exception_lineno = 36;
313         type_description_1 = "ooo";
314         goto frame_exception_exit_1;
315     }
316  
317     Py_INCREF( tmp_tuple_element_1 );
318     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
319     tmp_tuple_element_1 = var_t;
320  
321     CHECK_OBJECT( tmp_tuple_element_1 );
322     Py_INCREF( tmp_tuple_element_1 );
323     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
324     tmp_tuple_element_1 = var_local_value;
325  
326     if ( tmp_tuple_element_1 == NULL )
327     {
328         Py_DECREF( tmp_return_value );
329         exception_type = PyExc_UnboundLocalError;
330         Py_INCREF( exception_type );
331         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
332         exception_tb = NULL;
333         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
334         CHAIN_EXCEPTION( exception_value );
335  
336         exception_lineno = 36;
337         type_description_1 = "ooo";
338         goto frame_exception_exit_1;
339     }
340  
341     Py_INCREF( tmp_tuple_element_1 );
342     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
343     goto frame_return_exit_1;
344 272
345 #if 0 273 #if 0
346     RESTORE_FRAME_EXCEPTION( frame_cf843eab34e3f3f0ba22e6625b6aa386 ); 274     RESTORE_FRAME_EXCEPTION( frame_cf843eab34e3f3f0ba22e6625b6aa386 );
347 #endif 275 #endif
348 276
349     // Put the previous frame back on top. 277     // Put the previous frame back on top.
350     popFrameStack(); 278     popFrameStack();
351 279
352     goto frame_no_exception_1; 280     goto frame_no_exception_1;
n 353   n
354     frame_return_exit_1:;
355 #if 0
356     RESTORE_FRAME_EXCEPTION( frame_cf843eab34e3f3f0ba22e6625b6aa386 );
357 #endif
358  
359     // Put the previous frame back on top.
360     popFrameStack();
361  
362     goto try_return_handler_1;
363 281
364     frame_exception_exit_1:; 282     frame_exception_exit_1:;
365 283
366 #if 0 284 #if 0
367     RESTORE_FRAME_EXCEPTION( frame_cf843eab34e3f3f0ba22e6625b6aa386 ); 285     RESTORE_FRAME_EXCEPTION( frame_cf843eab34e3f3f0ba22e6625b6aa386 );
401     // Return the error. 319     // Return the error.
402     goto try_except_handler_1; 320     goto try_except_handler_1;
403 321
404     frame_no_exception_1:; 322     frame_no_exception_1:;
405 323
n n 324     tmp_return_value = PyTuple_New( 3 );
325     tmp_tuple_element_1 = var_s;
326  
327     CHECK_OBJECT( tmp_tuple_element_1 );
328     Py_INCREF( tmp_tuple_element_1 );
329     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
330     tmp_tuple_element_1 = var_t;
331  
332     CHECK_OBJECT( tmp_tuple_element_1 );
333     Py_INCREF( tmp_tuple_element_1 );
334     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
335     tmp_tuple_element_1 = var_local_value;
336  
337     CHECK_OBJECT( tmp_tuple_element_1 );
338     Py_INCREF( tmp_tuple_element_1 );
339     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
340     goto try_return_handler_1;
406     // tried codes exits in all cases 341     // tried codes exits in all cases
407     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 342     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
408     return NULL; 343     return NULL;
409     // Return handler code: 344     // Return handler code:
410     try_return_handler_1:; 345     try_return_handler_1:;
n n 346     CHECK_OBJECT( (PyObject *)var_local_value );
411     Py_XDECREF( var_local_value ); 347     Py_DECREF( var_local_value );
412     var_local_value = NULL; 348     var_local_value = NULL;
413 349
414     Py_XDECREF( var_s ); 350     Py_XDECREF( var_s );
415     var_s = NULL; 351     var_s = NULL;
416 352
432     Py_XDECREF( var_local_value ); 368     Py_XDECREF( var_local_value );
433     var_local_value = NULL; 369     var_local_value = NULL;
434 370
435     Py_XDECREF( var_s ); 371     Py_XDECREF( var_s );
436     var_s = NULL; 372     var_s = NULL;
t 437   t
438     Py_XDECREF( var_t );
439     var_t = NULL;
440 373
441     // Re-raise. 374     // Re-raise.
442     exception_type = exception_keeper_type_1; 375     exception_type = exception_keeper_type_1;
443     exception_value = exception_keeper_value_1; 376     exception_value = exception_keeper_value_1;
444     exception_tb = exception_keeper_tb_1; 377     exception_tb = exception_keeper_tb_1;