Construct OperationIntegerMul

Performance Diagrams

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