Construct OperationIntegerPower

Performance Diagrams

Construct OperationIntegerPower 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)2048807088.95192307692307257.0CPython 2.713001100242.31730769230768347.3035508544165Nuitka (master)13001011395.6826923076923347.30462432152353Nuitka (develop)13000945549.0480769230769347.30542037578266Nuitka (factory)Construct OperationIntegerPowerTicks Construct OperationIntegerPower 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)6357526188.95192307692307286.9929137312459CPython 3.572350833242.31730769230768257.02254717527273Nuitka (master)72347369395.6826923076923257.0343774411232Nuitka (develop)72357435549.0480769230769257.0Nuitka (factory)Construct OperationIntegerPowerTicks

Source Code with Construct

module_value1 = -1
module_value2 = 17

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 = -1
module_value2 = 17

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