Construct OperationIntegerMul

Performance Diagrams

Construct OperationIntegerMul 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1423790788.95192307692307257.0CPython 2.75550090242.31730769230768407.78713742287243Nuitka (master)5549886395.6826923076923407.79067807940726Nuitka (develop)5550108549.0480769230769407.7868250120017Nuitka (factory)Construct OperationIntegerMulTicks Construct OperationIntegerMul 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1922306188.95192307692307257.0CPython 3.511653369242.31730769230768354.30954659094095Nuitka (master)11651025395.6826923076923354.3396790688818Nuitka (develop)11651181549.0480769230769354.3376736650598Nuitka (factory)Construct OperationIntegerMulTicks

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
137     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 137     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
138     PyObject *exception_type = NULL; 138     PyObject *exception_type = NULL;
139     PyObject *exception_value = NULL; 139     PyObject *exception_value = NULL;
140     PyTracebackObject *exception_tb = NULL; 140     PyTracebackObject *exception_tb = NULL;
141     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 141     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n n 142     static struct Nuitka_FrameObject *cache_frame_96e4415bfb00becb91dacb23c06206e6 = NULL;
142     PyObject *tmp_return_value = NULL; 143     PyObject *tmp_return_value = NULL;
n 143     static struct Nuitka_FrameObject *cache_frame_96e4415bfb00becb91dacb23c06206e6 = NULL; n
144     PyObject *exception_keeper_type_1; 144     PyObject *exception_keeper_type_1;
145     PyObject *exception_keeper_value_1; 145     PyObject *exception_keeper_value_1;
146     PyTracebackObject *exception_keeper_tb_1; 146     PyTracebackObject *exception_keeper_tb_1;
147     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 147     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
148 148
268     assert( var_t == NULL ); 268     assert( var_t == NULL );
269     Py_INCREF( tmp_assign_source_3 ); 269     Py_INCREF( tmp_assign_source_3 );
270     var_t = tmp_assign_source_3; 270     var_t = tmp_assign_source_3;
271 271
272     } 272     }
n 273     { n
274     PyObject *tmp_assign_source_4;
275     PyObject *tmp_left_name_1;
276     PyObject *tmp_right_name_1;
277     tmp_left_name_1 = var_s;
278  
279     CHECK_OBJECT( tmp_left_name_1 );
280     tmp_right_name_1 = var_t;
281  
282     CHECK_OBJECT( tmp_right_name_1 );
283     tmp_assign_source_4 = BINARY_OPERATION_MUL( tmp_left_name_1, tmp_right_name_1 );
284     if ( tmp_assign_source_4 == NULL )
285     {
286         assert( ERROR_OCCURRED() );
287  
288         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
289  
290  
291         exception_lineno = 33;
292         type_description_1 = "ooo";
293         goto frame_exception_exit_1;
294     }
295     {
296         PyObject *old = var_t;
297         var_t = tmp_assign_source_4;
298         Py_XDECREF( old );
299     }
300  
301     }
302     {
303     PyObject *tmp_tuple_element_1;
304     tmp_tuple_element_1 = var_s;
305  
306     if ( tmp_tuple_element_1 == NULL )
307     {
308  
309         exception_type = PyExc_UnboundLocalError;
310         Py_INCREF( exception_type );
311         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
312         exception_tb = NULL;
313         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
314         CHAIN_EXCEPTION( exception_value );
315  
316         exception_lineno = 36;
317         type_description_1 = "ooo";
318         goto frame_exception_exit_1;
319     }
320  
321     tmp_return_value = PyTuple_New( 3 );
322     Py_INCREF( tmp_tuple_element_1 );
323     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
324     tmp_tuple_element_1 = var_t;
325  
326     CHECK_OBJECT( tmp_tuple_element_1 );
327     Py_INCREF( tmp_tuple_element_1 );
328     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
329     tmp_tuple_element_1 = var_local_value;
330  
331     if ( tmp_tuple_element_1 == NULL )
332     {
333         Py_DECREF( tmp_return_value );
334         exception_type = PyExc_UnboundLocalError;
335         Py_INCREF( exception_type );
336         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
337         exception_tb = NULL;
338         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
339         CHAIN_EXCEPTION( exception_value );
340  
341         exception_lineno = 36;
342         type_description_1 = "ooo";
343         goto frame_exception_exit_1;
344     }
345  
346     Py_INCREF( tmp_tuple_element_1 );
347     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
348     goto frame_return_exit_1;
349     }
350 273
351 #if 0 274 #if 0
352     RESTORE_FRAME_EXCEPTION( frame_96e4415bfb00becb91dacb23c06206e6 ); 275     RESTORE_FRAME_EXCEPTION( frame_96e4415bfb00becb91dacb23c06206e6 );
353 #endif 276 #endif
354 277
355     // Put the previous frame back on top. 278     // Put the previous frame back on top.
356     popFrameStack(); 279     popFrameStack();
357 280
358     goto frame_no_exception_1; 281     goto frame_no_exception_1;
n 359   n
360     frame_return_exit_1:;
361 #if 0
362     RESTORE_FRAME_EXCEPTION( frame_96e4415bfb00becb91dacb23c06206e6 );
363 #endif
364  
365     // Put the previous frame back on top.
366     popFrameStack();
367  
368     goto try_return_handler_1;
369 282
370     frame_exception_exit_1:; 283     frame_exception_exit_1:;
371 284
372 #if 0 285 #if 0
373     RESTORE_FRAME_EXCEPTION( frame_96e4415bfb00becb91dacb23c06206e6 ); 286     RESTORE_FRAME_EXCEPTION( frame_96e4415bfb00becb91dacb23c06206e6 );
407     // Return the error. 320     // Return the error.
408     goto try_except_handler_1; 321     goto try_except_handler_1;
409 322
410     frame_no_exception_1:; 323     frame_no_exception_1:;
411 324
n n 325     {
326     PyObject *tmp_tuple_element_1;
327     tmp_tuple_element_1 = var_s;
328  
329     CHECK_OBJECT( tmp_tuple_element_1 );
330     tmp_return_value = PyTuple_New( 3 );
331     Py_INCREF( tmp_tuple_element_1 );
332     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
333     tmp_tuple_element_1 = var_t;
334  
335     CHECK_OBJECT( tmp_tuple_element_1 );
336     Py_INCREF( tmp_tuple_element_1 );
337     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
338     tmp_tuple_element_1 = var_local_value;
339  
340     CHECK_OBJECT( tmp_tuple_element_1 );
341     Py_INCREF( tmp_tuple_element_1 );
342     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
343     goto try_return_handler_1;
344     }
412     // tried codes exits in all cases 345     // tried codes exits in all cases
413     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 346     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
414     return NULL; 347     return NULL;
415     // Return handler code: 348     // Return handler code:
416     try_return_handler_1:; 349     try_return_handler_1:;
417     { 350     {
n n 351     CHECK_OBJECT( (PyObject *)var_s );
418     Py_XDECREF( var_s ); 352     Py_DECREF( var_s );
419     var_s = NULL; 353     var_s = NULL;
420 354
421     } 355     }
422     { 356     {
423     Py_XDECREF( var_t ); 357     Py_XDECREF( var_t );
444     exception_lineno = 0; 378     exception_lineno = 0;
445 379
446     { 380     {
447     Py_XDECREF( var_s ); 381     Py_XDECREF( var_s );
448     var_s = NULL; 382     var_s = NULL;
t 449   t
450     }
451     {
452     Py_XDECREF( var_t );
453     var_t = NULL;
454 383
455     } 384     }
456     { 385     {
457     Py_XDECREF( var_local_value ); 386     Py_XDECREF( var_local_value );
458     var_local_value = NULL; 387     var_local_value = NULL;