Construct OperationIntegerMul

Performance Diagrams

Construct OperationIntegerMul 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1278005873.61538461538461257.0CPython 2.75701557196.30769230769232393.8699967649118Nuitka (historic)5151487319.0000000000001404.506158166948Nuitka (master)5150649441.69230769230774404.5223617469558Nuitka (develop)5150625564.3846153846155404.52282581129975Nuitka (factory)Construct OperationIntegerMulTicks Construct OperationIntegerMul 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1857817173.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)12302162319.0000000000001340.47960506363177Nuitka (master)12296054441.69230769230774340.5608499164879Nuitka (develop)12306592564.3846153846155340.4206799329584Nuitka (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

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
137     PyTracebackObject *exception_keeper_tb_1; 137     PyTracebackObject *exception_keeper_tb_1;
138     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 138     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
139     PyObject *tmp_assign_source_1; 139     PyObject *tmp_assign_source_1;
140     PyObject *tmp_assign_source_2; 140     PyObject *tmp_assign_source_2;
141     PyObject *tmp_assign_source_3; 141     PyObject *tmp_assign_source_3;
n 142     PyObject *tmp_assign_source_4; n
143     PyObject *tmp_frame_locals; 142     PyObject *tmp_frame_locals;
n 144     PyObject *tmp_left_name_1; n
145     PyObject *tmp_return_value; 143     PyObject *tmp_return_value;
n 146     PyObject *tmp_right_name_1; n
147     PyObject *tmp_tuple_element_1; 144     PyObject *tmp_tuple_element_1;
148     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 145     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
149     static PyFrameObject *cache_frame_function = NULL; 146     static PyFrameObject *cache_frame_function = NULL;
150 147
151     PyFrameObject *frame_function; 148     PyFrameObject *frame_function;
263 260
264     assert( var_t == NULL ); 261     assert( var_t == NULL );
265     Py_INCREF( tmp_assign_source_3 ); 262     Py_INCREF( tmp_assign_source_3 );
266     var_t = tmp_assign_source_3; 263     var_t = tmp_assign_source_3;
267 264
n 268     tmp_left_name_1 = var_s; n
269  
270     tmp_right_name_1 = var_t;
271  
272     tmp_assign_source_4 = BINARY_OPERATION_MUL( tmp_left_name_1, tmp_right_name_1 );
273     if ( tmp_assign_source_4 == NULL )
274     {
275         assert( ERROR_OCCURRED() );
276  
277         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
278  
279  
280         exception_lineno = 33;
281         goto frame_exception_exit_1;
282     }
283     {
284         PyObject *old = var_t;
285         var_t = tmp_assign_source_4;
286         Py_XDECREF( old );
287     }
288  
289     tmp_return_value = PyTuple_New( 3 );
290     tmp_tuple_element_1 = var_s;
291  
292     if ( tmp_tuple_element_1 == NULL )
293     {
294         Py_DECREF( tmp_return_value );
295         exception_type = PyExc_UnboundLocalError;
296         Py_INCREF( exception_type );
297         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
298         exception_tb = NULL;
299         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
300         CHAIN_EXCEPTION( exception_value );
301  
302         exception_lineno = 36;
303         goto frame_exception_exit_1;
304     }
305  
306     Py_INCREF( tmp_tuple_element_1 );
307     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
308     tmp_tuple_element_1 = var_t;
309  
310     Py_INCREF( tmp_tuple_element_1 );
311     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
312     tmp_tuple_element_1 = var_local_value;
313  
314     if ( tmp_tuple_element_1 == NULL )
315     {
316         Py_DECREF( tmp_return_value );
317         exception_type = PyExc_UnboundLocalError;
318         Py_INCREF( exception_type );
319         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
320         exception_tb = NULL;
321         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
322         CHAIN_EXCEPTION( exception_value );
323  
324         exception_lineno = 36;
325         goto frame_exception_exit_1;
326     }
327  
328     Py_INCREF( tmp_tuple_element_1 );
329     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
330     goto frame_return_exit_1;
331 265
332 #if 0 266 #if 0
333     RESTORE_FRAME_EXCEPTION( frame_function ); 267     RESTORE_FRAME_EXCEPTION( frame_function );
334 #endif 268 #endif
335     // Put the previous frame back on top. 269     // Put the previous frame back on top.
337 #if PYTHON_VERSION >= 340 271 #if PYTHON_VERSION >= 340
338     frame_function->f_executing -= 1; 272     frame_function->f_executing -= 1;
339 #endif 273 #endif
340     Py_DECREF( frame_function ); 274     Py_DECREF( frame_function );
341     goto frame_no_exception_1; 275     goto frame_no_exception_1;
n 342   n
343     frame_return_exit_1:;
344 #if 0
345     RESTORE_FRAME_EXCEPTION( frame_function );
346 #endif
347     popFrameStack();
348 #if PYTHON_VERSION >= 340
349     frame_function->f_executing -= 1;
350 #endif
351     Py_DECREF( frame_function );
352     goto try_return_handler_1;
353 276
354     frame_exception_exit_1:; 277     frame_exception_exit_1:;
355 #if 0 278 #if 0
356     RESTORE_FRAME_EXCEPTION( frame_function ); 279     RESTORE_FRAME_EXCEPTION( frame_function );
357 #endif 280 #endif
426     // Return the error. 349     // Return the error.
427     goto try_except_handler_1; 350     goto try_except_handler_1;
428 351
429     frame_no_exception_1:; 352     frame_no_exception_1:;
430 353
n n 354     tmp_return_value = PyTuple_New( 3 );
355     tmp_tuple_element_1 = var_s;
356  
357     Py_INCREF( tmp_tuple_element_1 );
358     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
359     tmp_tuple_element_1 = var_t;
360  
361     Py_INCREF( tmp_tuple_element_1 );
362     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
363     tmp_tuple_element_1 = var_local_value;
364  
365     Py_INCREF( tmp_tuple_element_1 );
366     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
367     goto try_return_handler_1;
431     // tried codes exits in all cases 368     // tried codes exits in all cases
432     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 369     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
433     return NULL; 370     return NULL;
434     // Return handler code: 371     // Return handler code:
435     try_return_handler_1:; 372     try_return_handler_1:;
n n 373     CHECK_OBJECT( (PyObject *)var_local_value );
436     Py_XDECREF( var_local_value ); 374     Py_DECREF( var_local_value );
437     var_local_value = NULL; 375     var_local_value = NULL;
438 376
439     Py_XDECREF( var_s ); 377     Py_XDECREF( var_s );
440     var_s = NULL; 378     var_s = NULL;
441 379
457     Py_XDECREF( var_local_value ); 395     Py_XDECREF( var_local_value );
458     var_local_value = NULL; 396     var_local_value = NULL;
459 397
460     Py_XDECREF( var_s ); 398     Py_XDECREF( var_s );
461     var_s = NULL; 399     var_s = NULL;
t 462   t
463     Py_XDECREF( var_t );
464     var_t = NULL;
465 400
466     // Re-raise. 401     // Re-raise.
467     exception_type = exception_keeper_type_1; 402     exception_type = exception_keeper_type_1;
468     exception_value = exception_keeper_value_1; 403     exception_value = exception_keeper_value_1;
469     exception_tb = exception_keeper_tb_1; 404     exception_tb = exception_keeper_tb_1;