Construct OperationIntegerPower

Performance Diagrams

Construct OperationIntegerPower 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1923043088.95192307692307257.0CPython 2.712651007242.31730769230768341.5470769604376Nuitka (master)12651001395.6826923076923341.5471540617977Nuitka (develop)12651020549.0480769230769341.54690990749083Nuitka (factory)Construct OperationIntegerPowerTicks Construct OperationIntegerPower 0010000000100000002000000020000000300000003000000040000000400000005000000050000000600000006000000070000000700000008000000080000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)8072857788.95192307692307257.0CPython 3.574830423242.31730769230768275.0546300751811Nuitka (master)74843682395.6826923076923275.01404342041303Nuitka (develop)74847690549.0480769230769275.00177467372697Nuitka (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
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     PyObject *tmp_assign_source_1; 147     PyObject *tmp_assign_source_1;
148     PyObject *tmp_assign_source_2; 148     PyObject *tmp_assign_source_2;
149     PyObject *tmp_assign_source_3; 149     PyObject *tmp_assign_source_3;
n 150     PyObject *tmp_assign_source_4; n
151     PyObject *tmp_left_name_1;
152     PyObject *tmp_return_value; 150     PyObject *tmp_return_value;
n 153     PyObject *tmp_right_name_1; n
154     PyObject *tmp_tuple_element_1; 151     PyObject *tmp_tuple_element_1;
155     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 152     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
156     static struct Nuitka_FrameObject *cache_frame_dfff60cb1ffabb2ef108351410f5a158 = NULL; 153     static struct Nuitka_FrameObject *cache_frame_dfff60cb1ffabb2ef108351410f5a158 = NULL;
157 154
158     struct Nuitka_FrameObject *frame_dfff60cb1ffabb2ef108351410f5a158; 155     struct Nuitka_FrameObject *frame_dfff60cb1ffabb2ef108351410f5a158;
270 267
271     assert( var_t == NULL ); 268     assert( var_t == NULL );
272     Py_INCREF( tmp_assign_source_3 ); 269     Py_INCREF( tmp_assign_source_3 );
273     var_t = tmp_assign_source_3; 270     var_t = tmp_assign_source_3;
274 271
n 275     tmp_left_name_1 = var_s; n
276 272
n 277     CHECK_OBJECT( tmp_left_name_1 ); n 273 #if 0
278     tmp_right_name_1 = var_t; 274     RESTORE_FRAME_EXCEPTION( frame_dfff60cb1ffabb2ef108351410f5a158 );
275 #endif
279 276
n 280     CHECK_OBJECT( tmp_right_name_1 ); n 277     // Put the previous frame back on top.
281     tmp_assign_source_4 = POWER_OPERATION( tmp_left_name_1, tmp_right_name_1 ); 278     popFrameStack();
282     if ( tmp_assign_source_4 == NULL )
283     {
284         assert( ERROR_OCCURRED() );
285 279
n 286         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); n 280     goto frame_no_exception_1;
287 281
n 288   n
289         exception_lineno = 33;
290         type_description = "ooo";
291         goto frame_exception_exit_1; 282     frame_exception_exit_1:;
283  
284 #if 0
285     RESTORE_FRAME_EXCEPTION( frame_dfff60cb1ffabb2ef108351410f5a158 );
286 #endif
287  
288     if ( exception_tb == NULL )
292     } 289     {
290         exception_tb = MAKE_TRACEBACK( frame_dfff60cb1ffabb2ef108351410f5a158, exception_lineno );
293     { 291     }
294         PyObject *old = var_t; 292     else if ( exception_tb->tb_frame != &frame_dfff60cb1ffabb2ef108351410f5a158->m_frame )
295         var_t = tmp_assign_source_4;
296         Py_XDECREF( old );
297     } 293     {
294         exception_tb = ADD_TRACEBACK( exception_tb, frame_dfff60cb1ffabb2ef108351410f5a158, exception_lineno );
295     }
296  
297     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_dfff60cb1ffabb2ef108351410f5a158, type_description ,var_local_value, var_s, var_t );
298  
299     // Release cached frame.
300     if ( frame_dfff60cb1ffabb2ef108351410f5a158 == cache_frame_dfff60cb1ffabb2ef108351410f5a158 )
301     {
302         Py_DECREF( frame_dfff60cb1ffabb2ef108351410f5a158 );
303     }
304     cache_frame_dfff60cb1ffabb2ef108351410f5a158 = NULL;
305  
306     assertFrameObject( frame_dfff60cb1ffabb2ef108351410f5a158 );
307  
308  
309     // Put the previous frame back on top.
310     popFrameStack();
311  
312     // Return the error.
313     goto try_except_handler_1;
314  
315     frame_no_exception_1:;
298 316
299     tmp_return_value = PyTuple_New( 3 ); 317     tmp_return_value = PyTuple_New( 3 );
300     tmp_tuple_element_1 = var_s; 318     tmp_tuple_element_1 = var_s;
301 319
n 302     if ( tmp_tuple_element_1 == NULL ) n 320     CHECK_OBJECT( tmp_tuple_element_1 );
303     {
304         Py_DECREF( tmp_return_value );
305         exception_type = PyExc_UnboundLocalError;
306         Py_INCREF( exception_type );
307         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
308         exception_tb = NULL;
309         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
310         CHAIN_EXCEPTION( exception_value );
311  
312         exception_lineno = 36;
313         type_description = "ooo";
314         goto frame_exception_exit_1;
315     }
316  
317     Py_INCREF( tmp_tuple_element_1 ); 321     Py_INCREF( tmp_tuple_element_1 );
318     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); 322     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
319     tmp_tuple_element_1 = var_t; 323     tmp_tuple_element_1 = var_t;
320 324
321     CHECK_OBJECT( tmp_tuple_element_1 ); 325     CHECK_OBJECT( tmp_tuple_element_1 );
322     Py_INCREF( tmp_tuple_element_1 ); 326     Py_INCREF( tmp_tuple_element_1 );
323     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 327     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
324     tmp_tuple_element_1 = var_local_value; 328     tmp_tuple_element_1 = var_local_value;
325 329
n 326     if ( tmp_tuple_element_1 == NULL ) n 330     CHECK_OBJECT( tmp_tuple_element_1 );
327     {
328         Py_DECREF( tmp_return_value );
329         exception_type = PyExc_UnboundLocalError;
330         Py_INCREF( exception_type );
331         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
332         exception_tb = NULL;
333         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
334         CHAIN_EXCEPTION( exception_value );
335  
336         exception_lineno = 36;
337         type_description = "ooo";
338         goto frame_exception_exit_1;
339     }
340  
341     Py_INCREF( tmp_tuple_element_1 ); 331     Py_INCREF( tmp_tuple_element_1 );
342     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 ); 332     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
n 343     goto frame_return_exit_1; n
344  
345 #if 0
346     RESTORE_FRAME_EXCEPTION( frame_dfff60cb1ffabb2ef108351410f5a158 );
347 #endif
348  
349     // Put the previous frame back on top.
350     popFrameStack();
351  
352     goto frame_no_exception_1;
353  
354     frame_return_exit_1:;
355 #if 0
356     RESTORE_FRAME_EXCEPTION( frame_dfff60cb1ffabb2ef108351410f5a158 );
357 #endif
358  
359     // Put the previous frame back on top.
360     popFrameStack();
361  
362     goto try_return_handler_1; 333     goto try_return_handler_1;
n 363   n
364     frame_exception_exit_1:;
365  
366 #if 0
367     RESTORE_FRAME_EXCEPTION( frame_dfff60cb1ffabb2ef108351410f5a158 );
368 #endif
369  
370     if ( exception_tb == NULL )
371     {
372         exception_tb = MAKE_TRACEBACK( frame_dfff60cb1ffabb2ef108351410f5a158, exception_lineno );
373     }
374     else if ( exception_tb->tb_frame != &frame_dfff60cb1ffabb2ef108351410f5a158->m_frame )
375     {
376         exception_tb = ADD_TRACEBACK( exception_tb, frame_dfff60cb1ffabb2ef108351410f5a158, exception_lineno );
377     }
378  
379     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_dfff60cb1ffabb2ef108351410f5a158, type_description ,var_local_value, var_s, var_t );
380  
381     // Release cached frame.
382     if ( frame_dfff60cb1ffabb2ef108351410f5a158 == cache_frame_dfff60cb1ffabb2ef108351410f5a158 )
383     {
384         Py_DECREF( frame_dfff60cb1ffabb2ef108351410f5a158 );
385     }
386     cache_frame_dfff60cb1ffabb2ef108351410f5a158 = NULL;
387  
388     assertFrameObject( frame_dfff60cb1ffabb2ef108351410f5a158 );
389  
390  
391     // Put the previous frame back on top.
392     popFrameStack();
393  
394     // Return the error.
395     goto try_except_handler_1;
396  
397     frame_no_exception_1:;
398  
399     // tried codes exits in all cases 334     // tried codes exits in all cases
400     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 335     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
401     return NULL; 336     return NULL;
402     // Return handler code: 337     // Return handler code:
403     try_return_handler_1:; 338     try_return_handler_1:;
n n 339     CHECK_OBJECT( (PyObject *)var_local_value );
404     Py_XDECREF( var_local_value ); 340     Py_DECREF( var_local_value );
405     var_local_value = NULL; 341     var_local_value = NULL;
406 342
407     Py_XDECREF( var_s ); 343     Py_XDECREF( var_s );
408     var_s = NULL; 344     var_s = NULL;
409 345
425     Py_XDECREF( var_local_value ); 361     Py_XDECREF( var_local_value );
426     var_local_value = NULL; 362     var_local_value = NULL;
427 363
428     Py_XDECREF( var_s ); 364     Py_XDECREF( var_s );
429     var_s = NULL; 365     var_s = NULL;
t 430   t
431     Py_XDECREF( var_t );
432     var_t = NULL;
433 366
434     // Re-raise. 367     // Re-raise.
435     exception_type = exception_keeper_type_1; 368     exception_type = exception_keeper_type_1;
436     exception_value = exception_keeper_value_1; 369     exception_value = exception_keeper_value_1;
437     exception_tb = exception_keeper_tb_1; 370     exception_tb = exception_keeper_tb_1;