Construct OperationListIntegerIndexLookup

Performance Diagrams

Construct OperationListIntegerIndexLookup 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)868481489.78846153846155257.0CPython 2.75349194244.59615384615387351.91084313731636Nuitka (master)5350256399.4038461538462351.88062527214834Nuitka (develop)5350116554.2115384615385351.88460879486354Nuitka (factory)Construct OperationListIntegerIndexLookupTicks Construct OperationListIntegerIndexLookup 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1198586488.95192307692307257.0CPython 3.55644212242.31730769230768387.74733478345183Nuitka (master)5649622395.6826923076923387.6357955376562Nuitka (develop)5648042549.0480769230769387.66837077025457Nuitka (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
157     PyTracebackObject *exception_keeper_tb_1; 157     PyTracebackObject *exception_keeper_tb_1;
158     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 158     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
159     PyObject *tmp_assign_source_1; 159     PyObject *tmp_assign_source_1;
160     PyObject *tmp_assign_source_2; 160     PyObject *tmp_assign_source_2;
161     PyObject *tmp_assign_source_3; 161     PyObject *tmp_assign_source_3;
n 162     PyObject *tmp_assign_source_4; n
163     PyObject *tmp_return_value; 162     PyObject *tmp_return_value;
n 164     PyObject *tmp_subscribed_name_1; n
165     PyObject *tmp_subscript_name_1;
166     PyObject *tmp_tuple_element_1; 163     PyObject *tmp_tuple_element_1;
167     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 164     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
168     static struct Nuitka_FrameObject *cache_frame_cf65aeef33030b4aa7fc8f1109e0476a = NULL; 165     static struct Nuitka_FrameObject *cache_frame_cf65aeef33030b4aa7fc8f1109e0476a = NULL;
169 166
170     struct Nuitka_FrameObject *frame_cf65aeef33030b4aa7fc8f1109e0476a; 167     struct Nuitka_FrameObject *frame_cf65aeef33030b4aa7fc8f1109e0476a;
282 279
283     assert( var_t == NULL ); 280     assert( var_t == NULL );
284     Py_INCREF( tmp_assign_source_3 ); 281     Py_INCREF( tmp_assign_source_3 );
285     var_t = tmp_assign_source_3; 282     var_t = tmp_assign_source_3;
286 283
n 287     tmp_subscribed_name_1 = var_s; n
288  
289     CHECK_OBJECT( tmp_subscribed_name_1 );
290     tmp_subscript_name_1 = var_t;
291  
292     CHECK_OBJECT( tmp_subscript_name_1 );
293     tmp_assign_source_4 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
294     if ( tmp_assign_source_4 == NULL )
295     {
296         assert( ERROR_OCCURRED() );
297  
298         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
299  
300  
301         exception_lineno = 33;
302         type_description_1 = "ooo";
303         goto frame_exception_exit_1;
304     }
305     {
306         PyObject *old = var_t;
307         var_t = tmp_assign_source_4;
308         Py_XDECREF( old );
309     }
310  
311     tmp_return_value = PyTuple_New( 3 );
312     tmp_tuple_element_1 = var_s;
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", "s" );
320         exception_tb = NULL;
321         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
322         CHAIN_EXCEPTION( exception_value );
323  
324         exception_lineno = 36;
325         type_description_1 = "ooo";
326         goto frame_exception_exit_1;
327     }
328  
329     Py_INCREF( tmp_tuple_element_1 );
330     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
331     tmp_tuple_element_1 = var_t;
332  
333     CHECK_OBJECT( tmp_tuple_element_1 );
334     Py_INCREF( tmp_tuple_element_1 );
335     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
336     tmp_tuple_element_1 = var_local_value;
337  
338     if ( tmp_tuple_element_1 == NULL )
339     {
340         Py_DECREF( tmp_return_value );
341         exception_type = PyExc_UnboundLocalError;
342         Py_INCREF( exception_type );
343         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
344         exception_tb = NULL;
345         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
346         CHAIN_EXCEPTION( exception_value );
347  
348         exception_lineno = 36;
349         type_description_1 = "ooo";
350         goto frame_exception_exit_1;
351     }
352  
353     Py_INCREF( tmp_tuple_element_1 );
354     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
355     goto frame_return_exit_1;
356 284
357 #if 0 285 #if 0
358     RESTORE_FRAME_EXCEPTION( frame_cf65aeef33030b4aa7fc8f1109e0476a ); 286     RESTORE_FRAME_EXCEPTION( frame_cf65aeef33030b4aa7fc8f1109e0476a );
359 #endif 287 #endif
360 288
361     // Put the previous frame back on top. 289     // Put the previous frame back on top.
362     popFrameStack(); 290     popFrameStack();
363 291
364     goto frame_no_exception_1; 292     goto frame_no_exception_1;
n 365   n
366     frame_return_exit_1:;
367 #if 0
368     RESTORE_FRAME_EXCEPTION( frame_cf65aeef33030b4aa7fc8f1109e0476a );
369 #endif
370  
371     // Put the previous frame back on top.
372     popFrameStack();
373  
374     goto try_return_handler_1;
375 293
376     frame_exception_exit_1:; 294     frame_exception_exit_1:;
377 295
378 #if 0 296 #if 0
379     RESTORE_FRAME_EXCEPTION( frame_cf65aeef33030b4aa7fc8f1109e0476a ); 297     RESTORE_FRAME_EXCEPTION( frame_cf65aeef33030b4aa7fc8f1109e0476a );
413     // Return the error. 331     // Return the error.
414     goto try_except_handler_1; 332     goto try_except_handler_1;
415 333
416     frame_no_exception_1:; 334     frame_no_exception_1:;
417 335
n n 336     tmp_return_value = PyTuple_New( 3 );
337     tmp_tuple_element_1 = var_s;
338  
339     CHECK_OBJECT( tmp_tuple_element_1 );
340     Py_INCREF( tmp_tuple_element_1 );
341     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
342     tmp_tuple_element_1 = var_t;
343  
344     CHECK_OBJECT( tmp_tuple_element_1 );
345     Py_INCREF( tmp_tuple_element_1 );
346     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
347     tmp_tuple_element_1 = var_local_value;
348  
349     CHECK_OBJECT( tmp_tuple_element_1 );
350     Py_INCREF( tmp_tuple_element_1 );
351     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
352     goto try_return_handler_1;
418     // tried codes exits in all cases 353     // tried codes exits in all cases
419     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 354     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
420     return NULL; 355     return NULL;
421     // Return handler code: 356     // Return handler code:
422     try_return_handler_1:; 357     try_return_handler_1:;
n n 358     CHECK_OBJECT( (PyObject *)var_local_value );
423     Py_XDECREF( var_local_value ); 359     Py_DECREF( var_local_value );
424     var_local_value = NULL; 360     var_local_value = NULL;
425 361
426     Py_XDECREF( var_s ); 362     Py_XDECREF( var_s );
427     var_s = NULL; 363     var_s = NULL;
428 364
444     Py_XDECREF( var_local_value ); 380     Py_XDECREF( var_local_value );
445     var_local_value = NULL; 381     var_local_value = NULL;
446 382
447     Py_XDECREF( var_s ); 383     Py_XDECREF( var_s );
448     var_s = NULL; 384     var_s = NULL;
t 449   t
450     Py_XDECREF( var_t );
451     var_t = NULL;
452 385
453     // Re-raise. 386     // Re-raise.
454     exception_type = exception_keeper_type_1; 387     exception_type = exception_keeper_type_1;
455     exception_value = exception_keeper_value_1; 388     exception_value = exception_keeper_value_1;
456     exception_tb = exception_keeper_tb_1; 389     exception_tb = exception_keeper_tb_1;