Construct OperationIntegerAdd

Performance Diagrams

Construct OperationIntegerAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1008082573.61538461538461257.0CPython 2.75300213196.30769230769232374.18909643575034Nuitka (historic)3249932319.0000000000001424.4484728146296Nuitka (master)3450531441.69230769230774419.5311075158112Nuitka (develop)3450537564.3846153846155419.53096043535817Nuitka (factory)Construct OperationIntegerAddTicks Construct OperationIntegerAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1672880473.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)10049015319.0000000000001355.67284163796853Nuitka (master)10048693441.69230769230774355.67759817369256Nuitka (develop)10049909564.3846153846155355.6596356040019Nuitka (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

for x in xrange(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

for x in xrange(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 for x in xrange(50000): 38 for x in xrange(50000):
39     calledRepeatedly() 39     calledRepeatedly()

Context Diff of Generated Code


Construct
Baseline
136     PyTracebackObject *exception_keeper_tb_1; 136     PyTracebackObject *exception_keeper_tb_1;
137     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 137     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
138     PyObject *tmp_assign_source_1; 138     PyObject *tmp_assign_source_1;
139     PyObject *tmp_assign_source_2; 139     PyObject *tmp_assign_source_2;
140     PyObject *tmp_assign_source_3; 140     PyObject *tmp_assign_source_3;
n 141     PyObject *tmp_assign_source_4; n
142     PyObject *tmp_left_name_1;
143     PyObject *tmp_return_value; 141     PyObject *tmp_return_value;
n 144     PyObject *tmp_right_name_1; n
145     PyObject *tmp_tuple_element_1; 142     PyObject *tmp_tuple_element_1;
146     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 143     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
147     static struct Nuitka_FrameObject *cache_frame_acb2145a3558fb2755efc5ccf13746b8 = NULL; 144     static struct Nuitka_FrameObject *cache_frame_acb2145a3558fb2755efc5ccf13746b8 = NULL;
148 145
149     struct Nuitka_FrameObject *frame_acb2145a3558fb2755efc5ccf13746b8; 146     struct Nuitka_FrameObject *frame_acb2145a3558fb2755efc5ccf13746b8;
261 258
262     assert( var_t == NULL ); 259     assert( var_t == NULL );
263     Py_INCREF( tmp_assign_source_3 ); 260     Py_INCREF( tmp_assign_source_3 );
264     var_t = tmp_assign_source_3; 261     var_t = tmp_assign_source_3;
265 262
n 266     tmp_left_name_1 = var_s; n
267 263
n 268     CHECK_OBJECT( tmp_left_name_1 ); n 264 #if 0
269     tmp_right_name_1 = var_t; 265     RESTORE_FRAME_EXCEPTION( frame_acb2145a3558fb2755efc5ccf13746b8 );
266 #endif
270 267
n 271     CHECK_OBJECT( tmp_right_name_1 ); n 268     // Put the previous frame back on top.
272     tmp_assign_source_4 = BINARY_OPERATION_ADD( tmp_left_name_1, tmp_right_name_1 ); 269     popFrameStack();
273     if ( tmp_assign_source_4 == NULL )
274     {
275         assert( ERROR_OCCURRED() );
276 270
n 277         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); n 271     goto frame_no_exception_1;
278 272
n 279   n
280         exception_lineno = 33;
281         type_description = "ooo";
282         goto frame_exception_exit_1; 273     frame_exception_exit_1:;
274  
275 #if 0
276     RESTORE_FRAME_EXCEPTION( frame_acb2145a3558fb2755efc5ccf13746b8 );
277 #endif
278  
279     if ( exception_tb == NULL )
283     } 280     {
281         exception_tb = MAKE_TRACEBACK( frame_acb2145a3558fb2755efc5ccf13746b8, exception_lineno );
284     { 282     }
285         PyObject *old = var_t; 283     else if ( exception_tb->tb_frame != &frame_acb2145a3558fb2755efc5ccf13746b8->m_frame )
286         var_t = tmp_assign_source_4;
287         Py_XDECREF( old );
288     } 284     {
285         exception_tb = ADD_TRACEBACK( exception_tb, frame_acb2145a3558fb2755efc5ccf13746b8, exception_lineno );
286     }
287  
288     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_acb2145a3558fb2755efc5ccf13746b8, type_description ,var_local_value, var_s, var_t );
289  
290     // Release cached frame.
291     if ( frame_acb2145a3558fb2755efc5ccf13746b8 == cache_frame_acb2145a3558fb2755efc5ccf13746b8 )
292     {
293         Py_DECREF( frame_acb2145a3558fb2755efc5ccf13746b8 );
294     }
295     cache_frame_acb2145a3558fb2755efc5ccf13746b8 = NULL;
296  
297     assertFrameObject( frame_acb2145a3558fb2755efc5ccf13746b8 );
298  
299  
300     // Put the previous frame back on top.
301     popFrameStack();
302  
303     // Return the error.
304     goto try_except_handler_1;
305  
306     frame_no_exception_1:;
289 307
290     tmp_return_value = PyTuple_New( 3 ); 308     tmp_return_value = PyTuple_New( 3 );
291     tmp_tuple_element_1 = var_s; 309     tmp_tuple_element_1 = var_s;
292 310
n 293     if ( tmp_tuple_element_1 == NULL ) n 311     CHECK_OBJECT( tmp_tuple_element_1 );
294     {
295         Py_DECREF( tmp_return_value );
296         exception_type = PyExc_UnboundLocalError;
297         Py_INCREF( exception_type );
298         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
299         exception_tb = NULL;
300         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
301         CHAIN_EXCEPTION( exception_value );
302  
303         exception_lineno = 36;
304         type_description = "ooo";
305         goto frame_exception_exit_1;
306     }
307  
308     Py_INCREF( tmp_tuple_element_1 ); 312     Py_INCREF( tmp_tuple_element_1 );
309     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); 313     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
310     tmp_tuple_element_1 = var_t; 314     tmp_tuple_element_1 = var_t;
311 315
312     CHECK_OBJECT( tmp_tuple_element_1 ); 316     CHECK_OBJECT( tmp_tuple_element_1 );
313     Py_INCREF( tmp_tuple_element_1 ); 317     Py_INCREF( tmp_tuple_element_1 );
314     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 318     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
315     tmp_tuple_element_1 = var_local_value; 319     tmp_tuple_element_1 = var_local_value;
316 320
n 317     if ( tmp_tuple_element_1 == NULL ) n 321     CHECK_OBJECT( tmp_tuple_element_1 );
318     {
319         Py_DECREF( tmp_return_value );
320         exception_type = PyExc_UnboundLocalError;
321         Py_INCREF( exception_type );
322         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
323         exception_tb = NULL;
324         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
325         CHAIN_EXCEPTION( exception_value );
326  
327         exception_lineno = 36;
328         type_description = "ooo";
329         goto frame_exception_exit_1;
330     }
331  
332     Py_INCREF( tmp_tuple_element_1 ); 322     Py_INCREF( tmp_tuple_element_1 );
333     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 ); 323     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
n 334     goto frame_return_exit_1; n
335  
336 #if 0
337     RESTORE_FRAME_EXCEPTION( frame_acb2145a3558fb2755efc5ccf13746b8 );
338 #endif
339  
340     // Put the previous frame back on top.
341     popFrameStack();
342  
343     goto frame_no_exception_1;
344  
345     frame_return_exit_1:;
346 #if 0
347     RESTORE_FRAME_EXCEPTION( frame_acb2145a3558fb2755efc5ccf13746b8 );
348 #endif
349  
350     // Put the previous frame back on top.
351     popFrameStack();
352  
353     goto try_return_handler_1; 324     goto try_return_handler_1;
n 354   n
355     frame_exception_exit_1:;
356  
357 #if 0
358     RESTORE_FRAME_EXCEPTION( frame_acb2145a3558fb2755efc5ccf13746b8 );
359 #endif
360  
361     if ( exception_tb == NULL )
362     {
363         exception_tb = MAKE_TRACEBACK( frame_acb2145a3558fb2755efc5ccf13746b8, exception_lineno );
364     }
365     else if ( exception_tb->tb_frame != &frame_acb2145a3558fb2755efc5ccf13746b8->m_frame )
366     {
367         exception_tb = ADD_TRACEBACK( exception_tb, frame_acb2145a3558fb2755efc5ccf13746b8, exception_lineno );
368     }
369  
370     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_acb2145a3558fb2755efc5ccf13746b8, type_description ,var_local_value, var_s, var_t );
371  
372     // Release cached frame.
373     if ( frame_acb2145a3558fb2755efc5ccf13746b8 == cache_frame_acb2145a3558fb2755efc5ccf13746b8 )
374     {
375         Py_DECREF( frame_acb2145a3558fb2755efc5ccf13746b8 );
376     }
377     cache_frame_acb2145a3558fb2755efc5ccf13746b8 = NULL;
378  
379     assertFrameObject( frame_acb2145a3558fb2755efc5ccf13746b8 );
380  
381  
382     // Put the previous frame back on top.
383     popFrameStack();
384  
385     // Return the error.
386     goto try_except_handler_1;
387  
388     frame_no_exception_1:;
389  
390     // tried codes exits in all cases 325     // tried codes exits in all cases
391     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 326     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
392     return NULL; 327     return NULL;
393     // Return handler code: 328     // Return handler code:
394     try_return_handler_1:; 329     try_return_handler_1:;
n n 330     CHECK_OBJECT( (PyObject *)var_local_value );
395     Py_XDECREF( var_local_value ); 331     Py_DECREF( var_local_value );
396     var_local_value = NULL; 332     var_local_value = NULL;
397 333
398     Py_XDECREF( var_s ); 334     Py_XDECREF( var_s );
399     var_s = NULL; 335     var_s = NULL;
400 336
416     Py_XDECREF( var_local_value ); 352     Py_XDECREF( var_local_value );
417     var_local_value = NULL; 353     var_local_value = NULL;
418 354
419     Py_XDECREF( var_s ); 355     Py_XDECREF( var_s );
420     var_s = NULL; 356     var_s = NULL;
t 421   t
422     Py_XDECREF( var_t );
423     var_t = NULL;
424 357
425     // Re-raise. 358     // Re-raise.
426     exception_type = exception_keeper_type_1; 359     exception_type = exception_keeper_type_1;
427     exception_value = exception_keeper_value_1; 360     exception_value = exception_keeper_value_1;
428     exception_tb = exception_keeper_tb_1; 361     exception_tb = exception_keeper_tb_1;