Construct OperationListIntegerIndexLookup

Performance Diagrams

Construct OperationListIntegerIndexLookup 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)984274489.78846153846155257.0CPython 2.75349942244.59615384615387369.79786350541775Nuitka (master)5349858399.4038461538462369.7999724388928Nuitka (develop)5349966554.2115384615385369.79726095299634Nuitka (factory)Construct OperationListIntegerIndexLookupTicks Construct OperationListIntegerIndexLookup 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1293097788.95192307692307257.0CPython 3.55400144242.31730769230768400.91678937092155Nuitka (master)5403834395.6826923076923400.8462722112954Nuitka (develop)5403616549.0480769230769400.85043826571234Nuitka (factory)Construct OperationListIntegerIndexLookupTicks

Source Code with Construct

module_value1 = [1,2,3,4,5]
module_value2 = 3

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,2,3,4,5]
module_value2 = 3

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
151     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 151     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
152     PyObject *exception_type = NULL; 152     PyObject *exception_type = NULL;
153     PyObject *exception_value = NULL; 153     PyObject *exception_value = NULL;
154     PyTracebackObject *exception_tb = NULL; 154     PyTracebackObject *exception_tb = NULL;
155     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 155     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n n 156     static struct Nuitka_FrameObject *cache_frame_9a2bea37cfdc6ae5c409441e6f38d81d = NULL;
156     PyObject *tmp_return_value = NULL; 157     PyObject *tmp_return_value = NULL;
n 157     static struct Nuitka_FrameObject *cache_frame_9a2bea37cfdc6ae5c409441e6f38d81d = NULL; n
158     PyObject *exception_keeper_type_1; 158     PyObject *exception_keeper_type_1;
159     PyObject *exception_keeper_value_1; 159     PyObject *exception_keeper_value_1;
160     PyTracebackObject *exception_keeper_tb_1; 160     PyTracebackObject *exception_keeper_tb_1;
161     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 161     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
162 162
282     assert( var_t == NULL ); 282     assert( var_t == NULL );
283     Py_INCREF( tmp_assign_source_3 ); 283     Py_INCREF( tmp_assign_source_3 );
284     var_t = tmp_assign_source_3; 284     var_t = tmp_assign_source_3;
285 285
286     } 286     }
n 287     { n
288     PyObject *tmp_assign_source_4;
289     PyObject *tmp_subscribed_name_1;
290     PyObject *tmp_subscript_name_1;
291     tmp_subscribed_name_1 = var_s;
292  
293     CHECK_OBJECT( tmp_subscribed_name_1 );
294     tmp_subscript_name_1 = var_t;
295  
296     CHECK_OBJECT( tmp_subscript_name_1 );
297     tmp_assign_source_4 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
298     if ( tmp_assign_source_4 == NULL )
299     {
300         assert( ERROR_OCCURRED() );
301  
302         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
303  
304  
305         exception_lineno = 33;
306         type_description_1 = "ooo";
307         goto frame_exception_exit_1;
308     }
309     {
310         PyObject *old = var_t;
311         var_t = tmp_assign_source_4;
312         Py_XDECREF( old );
313     }
314  
315     }
316     {
317     PyObject *tmp_tuple_element_1;
318     tmp_tuple_element_1 = var_s;
319  
320     if ( tmp_tuple_element_1 == NULL )
321     {
322  
323         exception_type = PyExc_UnboundLocalError;
324         Py_INCREF( exception_type );
325         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
326         exception_tb = NULL;
327         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
328         CHAIN_EXCEPTION( exception_value );
329  
330         exception_lineno = 36;
331         type_description_1 = "ooo";
332         goto frame_exception_exit_1;
333     }
334  
335     tmp_return_value = PyTuple_New( 3 );
336     Py_INCREF( tmp_tuple_element_1 );
337     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
338     tmp_tuple_element_1 = var_t;
339  
340     CHECK_OBJECT( tmp_tuple_element_1 );
341     Py_INCREF( tmp_tuple_element_1 );
342     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
343     tmp_tuple_element_1 = var_local_value;
344  
345     if ( tmp_tuple_element_1 == NULL )
346     {
347         Py_DECREF( tmp_return_value );
348         exception_type = PyExc_UnboundLocalError;
349         Py_INCREF( exception_type );
350         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
351         exception_tb = NULL;
352         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
353         CHAIN_EXCEPTION( exception_value );
354  
355         exception_lineno = 36;
356         type_description_1 = "ooo";
357         goto frame_exception_exit_1;
358     }
359  
360     Py_INCREF( tmp_tuple_element_1 );
361     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
362     goto frame_return_exit_1;
363     }
364 287
365 #if 0 288 #if 0
366     RESTORE_FRAME_EXCEPTION( frame_9a2bea37cfdc6ae5c409441e6f38d81d ); 289     RESTORE_FRAME_EXCEPTION( frame_9a2bea37cfdc6ae5c409441e6f38d81d );
367 #endif 290 #endif
368 291
369     // Put the previous frame back on top. 292     // Put the previous frame back on top.
370     popFrameStack(); 293     popFrameStack();
371 294
372     goto frame_no_exception_1; 295     goto frame_no_exception_1;
n 373   n
374     frame_return_exit_1:;
375 #if 0
376     RESTORE_FRAME_EXCEPTION( frame_9a2bea37cfdc6ae5c409441e6f38d81d );
377 #endif
378  
379     // Put the previous frame back on top.
380     popFrameStack();
381  
382     goto try_return_handler_1;
383 296
384     frame_exception_exit_1:; 297     frame_exception_exit_1:;
385 298
386 #if 0 299 #if 0
387     RESTORE_FRAME_EXCEPTION( frame_9a2bea37cfdc6ae5c409441e6f38d81d ); 300     RESTORE_FRAME_EXCEPTION( frame_9a2bea37cfdc6ae5c409441e6f38d81d );
421     // Return the error. 334     // Return the error.
422     goto try_except_handler_1; 335     goto try_except_handler_1;
423 336
424     frame_no_exception_1:; 337     frame_no_exception_1:;
425 338
n n 339     {
340     PyObject *tmp_tuple_element_1;
341     tmp_tuple_element_1 = var_s;
342  
343     CHECK_OBJECT( tmp_tuple_element_1 );
344     tmp_return_value = PyTuple_New( 3 );
345     Py_INCREF( tmp_tuple_element_1 );
346     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
347     tmp_tuple_element_1 = var_t;
348  
349     CHECK_OBJECT( tmp_tuple_element_1 );
350     Py_INCREF( tmp_tuple_element_1 );
351     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
352     tmp_tuple_element_1 = var_local_value;
353  
354     CHECK_OBJECT( tmp_tuple_element_1 );
355     Py_INCREF( tmp_tuple_element_1 );
356     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
357     goto try_return_handler_1;
358     }
426     // tried codes exits in all cases 359     // tried codes exits in all cases
427     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 360     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
428     return NULL; 361     return NULL;
429     // Return handler code: 362     // Return handler code:
430     try_return_handler_1:; 363     try_return_handler_1:;
431     { 364     {
n n 365     CHECK_OBJECT( (PyObject *)var_s );
432     Py_XDECREF( var_s ); 366     Py_DECREF( var_s );
433     var_s = NULL; 367     var_s = NULL;
434 368
435     } 369     }
436     { 370     {
437     Py_XDECREF( var_t ); 371     Py_XDECREF( var_t );
458     exception_lineno = 0; 392     exception_lineno = 0;
459 393
460     { 394     {
461     Py_XDECREF( var_s ); 395     Py_XDECREF( var_s );
462     var_s = NULL; 396     var_s = NULL;
t 463   t
464     }
465     {
466     Py_XDECREF( var_t );
467     var_t = NULL;
468 397
469     } 398     }
470     { 399     {
471     Py_XDECREF( var_local_value ); 400     Py_XDECREF( var_local_value );
472     var_local_value = NULL; 401     var_local_value = NULL;