Construct OperationListIntegerIndexLookup

Performance Diagrams

Construct OperationListIntegerIndexLookup 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)984274489.78846153846155257.0CPython 2.75350008244.59615384615387369.7962064862588Nuitka (master)5349252399.4038461538462369.815186887534Nuitka (develop)5350602554.2115384615385369.7812933138283Nuitka (factory)Construct OperationListIntegerIndexLookupTicks Construct OperationListIntegerIndexLookup 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1293097788.95192307692307257.0CPython 3.55402347242.31730769230768400.87468928890087Nuitka (master)5397610395.6826923076923400.96521497593307Nuitka (develop)5402848549.0480769230769400.86511500787844Nuitka (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
150     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 150     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
151     PyObject *exception_type = NULL; 151     PyObject *exception_type = NULL;
152     PyObject *exception_value = NULL; 152     PyObject *exception_value = NULL;
153     PyTracebackObject *exception_tb = NULL; 153     PyTracebackObject *exception_tb = NULL;
154     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 154     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n n 155     static struct Nuitka_FrameObject *cache_frame_102c2fe727b7586b278c6ca73210ba7d = NULL;
155     PyObject *tmp_return_value = NULL; 156     PyObject *tmp_return_value = NULL;
n 156     static struct Nuitka_FrameObject *cache_frame_102c2fe727b7586b278c6ca73210ba7d = NULL; n
157     PyObject *exception_keeper_type_1; 157     PyObject *exception_keeper_type_1;
158     PyObject *exception_keeper_value_1; 158     PyObject *exception_keeper_value_1;
159     PyTracebackObject *exception_keeper_tb_1; 159     PyTracebackObject *exception_keeper_tb_1;
160     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 160     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
161 161
288     assert( var_t == NULL ); 288     assert( var_t == NULL );
289     Py_INCREF( tmp_assign_source_3 ); 289     Py_INCREF( tmp_assign_source_3 );
290     var_t = tmp_assign_source_3; 290     var_t = tmp_assign_source_3;
291 291
292     } 292     }
n n 293  
294 #if 0
295     RESTORE_FRAME_EXCEPTION( frame_102c2fe727b7586b278c6ca73210ba7d );
296 #endif
297  
298     // Put the previous frame back on top.
299     popFrameStack();
300  
301     goto frame_no_exception_1;
302  
303     frame_exception_exit_1:;
304  
305 #if 0
306     RESTORE_FRAME_EXCEPTION( frame_102c2fe727b7586b278c6ca73210ba7d );
307 #endif
308  
309     if ( exception_tb == NULL )
310     {
311         exception_tb = MAKE_TRACEBACK( frame_102c2fe727b7586b278c6ca73210ba7d, exception_lineno );
293     { 312     }
294     PyObject *tmp_assign_source_4; 313     else if ( exception_tb->tb_frame != &frame_102c2fe727b7586b278c6ca73210ba7d->m_frame )
295     PyObject *tmp_subscribed_name_1; 314     {
315         exception_tb = ADD_TRACEBACK( exception_tb, frame_102c2fe727b7586b278c6ca73210ba7d, exception_lineno );
316     }
317  
318     // Attachs locals to frame if any.
319     Nuitka_Frame_AttachLocals(
320         (struct Nuitka_FrameObject *)frame_102c2fe727b7586b278c6ca73210ba7d,
321         type_description_1,
322         var_s,
323         var_t,
324         var_local_value
325     );
326  
327  
328     // Release cached frame.
329     if ( frame_102c2fe727b7586b278c6ca73210ba7d == cache_frame_102c2fe727b7586b278c6ca73210ba7d )
330     {
331         Py_DECREF( frame_102c2fe727b7586b278c6ca73210ba7d );
332     }
333     cache_frame_102c2fe727b7586b278c6ca73210ba7d = NULL;
334  
335     assertFrameObject( frame_102c2fe727b7586b278c6ca73210ba7d );
336  
337     // Put the previous frame back on top.
338     popFrameStack();
339  
340     // Return the error.
341     goto try_except_handler_1;
342  
343     frame_no_exception_1:;
344     {
296     PyObject *tmp_subscript_name_1; 345     PyObject *tmp_tuple_element_1;
297     CHECK_OBJECT( var_s ); 346     CHECK_OBJECT( var_s );
n 298     tmp_subscribed_name_1 = var_s; n
299     CHECK_OBJECT( var_t );
300     tmp_subscript_name_1 = var_t;
301     tmp_assign_source_4 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
302     if ( tmp_assign_source_4 == NULL )
303     {
304         assert( ERROR_OCCURRED() );
305  
306         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
307  
308  
309         exception_lineno = 33;
310         type_description_1 = "ooo";
311         goto frame_exception_exit_1;
312     }
313     {
314         PyObject *old = var_t;
315         var_t = tmp_assign_source_4;
316         Py_XDECREF( old );
317     }
318  
319     }
320     {
321     PyObject *tmp_tuple_element_1;
322     if ( var_s == NULL )
323     {
324  
325         exception_type = PyExc_UnboundLocalError;
326         Py_INCREF( exception_type );
327         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
328         exception_tb = NULL;
329         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
330         CHAIN_EXCEPTION( exception_value );
331  
332         exception_lineno = 36;
333         type_description_1 = "ooo";
334         goto frame_exception_exit_1;
335     }
336  
337     tmp_tuple_element_1 = var_s; 347     tmp_tuple_element_1 = var_s;
338     tmp_return_value = PyTuple_New( 3 ); 348     tmp_return_value = PyTuple_New( 3 );
339     Py_INCREF( tmp_tuple_element_1 ); 349     Py_INCREF( tmp_tuple_element_1 );
340     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); 350     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
341     CHECK_OBJECT( var_t ); 351     CHECK_OBJECT( var_t );
342     tmp_tuple_element_1 = var_t; 352     tmp_tuple_element_1 = var_t;
343     Py_INCREF( tmp_tuple_element_1 ); 353     Py_INCREF( tmp_tuple_element_1 );
344     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 354     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
n 345     if ( var_local_value == NULL ) n 355     CHECK_OBJECT( var_local_value );
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     tmp_tuple_element_1 = var_local_value; 356     tmp_tuple_element_1 = var_local_value;
361     Py_INCREF( tmp_tuple_element_1 ); 357     Py_INCREF( tmp_tuple_element_1 );
362     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 ); 358     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
n 363     goto frame_return_exit_1; n
364     }
365  
366 #if 0
367     RESTORE_FRAME_EXCEPTION( frame_102c2fe727b7586b278c6ca73210ba7d );
368 #endif
369  
370     // Put the previous frame back on top.
371     popFrameStack();
372  
373     goto frame_no_exception_1;
374  
375     frame_return_exit_1:;
376 #if 0
377     RESTORE_FRAME_EXCEPTION( frame_102c2fe727b7586b278c6ca73210ba7d );
378 #endif
379  
380     // Put the previous frame back on top.
381     popFrameStack();
382  
383     goto try_return_handler_1; 359     goto try_return_handler_1;
n 384   n
385     frame_exception_exit_1:;
386  
387 #if 0
388     RESTORE_FRAME_EXCEPTION( frame_102c2fe727b7586b278c6ca73210ba7d );
389 #endif
390  
391     if ( exception_tb == NULL )
392     { 360     }
393         exception_tb = MAKE_TRACEBACK( frame_102c2fe727b7586b278c6ca73210ba7d, exception_lineno );
394     }
395     else if ( exception_tb->tb_frame != &frame_102c2fe727b7586b278c6ca73210ba7d->m_frame )
396     {
397         exception_tb = ADD_TRACEBACK( exception_tb, frame_102c2fe727b7586b278c6ca73210ba7d, exception_lineno );
398     }
399  
400     // Attachs locals to frame if any.
401     Nuitka_Frame_AttachLocals(
402         (struct Nuitka_FrameObject *)frame_102c2fe727b7586b278c6ca73210ba7d,
403         type_description_1,
404         var_s,
405         var_t,
406         var_local_value
407     );
408  
409  
410     // Release cached frame.
411     if ( frame_102c2fe727b7586b278c6ca73210ba7d == cache_frame_102c2fe727b7586b278c6ca73210ba7d )
412     {
413         Py_DECREF( frame_102c2fe727b7586b278c6ca73210ba7d );
414     }
415     cache_frame_102c2fe727b7586b278c6ca73210ba7d = NULL;
416  
417     assertFrameObject( frame_102c2fe727b7586b278c6ca73210ba7d );
418  
419     // Put the previous frame back on top.
420     popFrameStack();
421  
422     // Return the error.
423     goto try_except_handler_1;
424  
425     frame_no_exception_1:;
426     // tried codes exits in all cases 361     // tried codes exits in all cases
427     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 362     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
428     return NULL; 363     return NULL;
429     // Return handler code: 364     // Return handler code:
430     try_return_handler_1:; 365     try_return_handler_1:;
431     { 366     {
n n 367     CHECK_OBJECT( (PyObject *)var_s );
432     Py_XDECREF( var_s ); 368     Py_DECREF( var_s );
433     var_s = NULL; 369     var_s = NULL;
434 370
435     } 371     }
436     { 372     {
437     Py_XDECREF( var_t ); 373     Py_XDECREF( var_t );
458     exception_lineno = 0; 394     exception_lineno = 0;
459 395
460     { 396     {
461     Py_XDECREF( var_s ); 397     Py_XDECREF( var_s );
462     var_s = NULL; 398     var_s = NULL;
t 463   t
464     }
465     {
466     Py_XDECREF( var_t );
467     var_t = NULL;
468 399
469     } 400     }
470     { 401     {
471     Py_XDECREF( var_local_value ); 402     Py_XDECREF( var_local_value );
472     var_local_value = NULL; 403     var_local_value = NULL;