Construct OperationListIntegerIndexLookup

Performance Diagrams

Construct OperationListIntegerIndexLookup 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)868481489.78846153846155257.0CPython 2.75349954244.59615384615387351.8892182997197Nuitka (master)5350052399.4038461538462351.886429833819Nuitka (develop)5350028554.2115384615385351.8871127234273Nuitka (factory)Construct OperationListIntegerIndexLookupTicks Construct OperationListIntegerIndexLookup 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1198586488.95192307692307257.0CPython 3.55652201242.31730769230768387.5826236864719Nuitka (master)5650422395.6826923076923387.6193017489988Nuitka (develop)5650302549.0480769230769387.62177581729736Nuitka (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_eea0b96afd566fff47c19baa8c48c699 = NULL; 165     static struct Nuitka_FrameObject *cache_frame_eea0b96afd566fff47c19baa8c48c699 = NULL;
169 166
170     struct Nuitka_FrameObject *frame_eea0b96afd566fff47c19baa8c48c699; 167     struct Nuitka_FrameObject *frame_eea0b96afd566fff47c19baa8c48c699;
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 284
n 289     CHECK_OBJECT( tmp_subscribed_name_1 ); n 285 #if 0
290     tmp_subscript_name_1 = var_t; 286     RESTORE_FRAME_EXCEPTION( frame_eea0b96afd566fff47c19baa8c48c699 );
287 #endif
291 288
n 292     CHECK_OBJECT( tmp_subscript_name_1 ); n 289     // Put the previous frame back on top.
293     tmp_assign_source_4 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 ); 290     popFrameStack();
294     if ( tmp_assign_source_4 == NULL )
295     {
296         assert( ERROR_OCCURRED() );
297 291
n 298         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); n 292     goto frame_no_exception_1;
299 293
n 300   n
301         exception_lineno = 33;
302         type_description = "ooo";
303         goto frame_exception_exit_1; 294     frame_exception_exit_1:;
295  
296 #if 0
297     RESTORE_FRAME_EXCEPTION( frame_eea0b96afd566fff47c19baa8c48c699 );
298 #endif
299  
300     if ( exception_tb == NULL )
304     } 301     {
302         exception_tb = MAKE_TRACEBACK( frame_eea0b96afd566fff47c19baa8c48c699, exception_lineno );
305     { 303     }
306         PyObject *old = var_t; 304     else if ( exception_tb->tb_frame != &frame_eea0b96afd566fff47c19baa8c48c699->m_frame )
307         var_t = tmp_assign_source_4;
308         Py_XDECREF( old );
309     } 305     {
306         exception_tb = ADD_TRACEBACK( exception_tb, frame_eea0b96afd566fff47c19baa8c48c699, exception_lineno );
307     }
308  
309     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_eea0b96afd566fff47c19baa8c48c699, type_description ,var_local_value, var_s, var_t );
310  
311     // Release cached frame.
312     if ( frame_eea0b96afd566fff47c19baa8c48c699 == cache_frame_eea0b96afd566fff47c19baa8c48c699 )
313     {
314         Py_DECREF( frame_eea0b96afd566fff47c19baa8c48c699 );
315     }
316     cache_frame_eea0b96afd566fff47c19baa8c48c699 = NULL;
317  
318     assertFrameObject( frame_eea0b96afd566fff47c19baa8c48c699 );
319  
320  
321     // Put the previous frame back on top.
322     popFrameStack();
323  
324     // Return the error.
325     goto try_except_handler_1;
326  
327     frame_no_exception_1:;
310 328
311     tmp_return_value = PyTuple_New( 3 ); 329     tmp_return_value = PyTuple_New( 3 );
312     tmp_tuple_element_1 = var_s; 330     tmp_tuple_element_1 = var_s;
313 331
n 314     if ( tmp_tuple_element_1 == NULL ) n 332     CHECK_OBJECT( tmp_tuple_element_1 );
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 = "ooo";
326         goto frame_exception_exit_1;
327     }
328  
329     Py_INCREF( tmp_tuple_element_1 ); 333     Py_INCREF( tmp_tuple_element_1 );
330     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); 334     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
331     tmp_tuple_element_1 = var_t; 335     tmp_tuple_element_1 = var_t;
332 336
333     CHECK_OBJECT( tmp_tuple_element_1 ); 337     CHECK_OBJECT( tmp_tuple_element_1 );
334     Py_INCREF( tmp_tuple_element_1 ); 338     Py_INCREF( tmp_tuple_element_1 );
335     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 339     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
336     tmp_tuple_element_1 = var_local_value; 340     tmp_tuple_element_1 = var_local_value;
337 341
n 338     if ( tmp_tuple_element_1 == NULL ) n 342     CHECK_OBJECT( tmp_tuple_element_1 );
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 = "ooo";
350         goto frame_exception_exit_1;
351     }
352  
353     Py_INCREF( tmp_tuple_element_1 ); 343     Py_INCREF( tmp_tuple_element_1 );
354     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 ); 344     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
n 355     goto frame_return_exit_1; n
356  
357 #if 0
358     RESTORE_FRAME_EXCEPTION( frame_eea0b96afd566fff47c19baa8c48c699 );
359 #endif
360  
361     // Put the previous frame back on top.
362     popFrameStack();
363  
364     goto frame_no_exception_1;
365  
366     frame_return_exit_1:;
367 #if 0
368     RESTORE_FRAME_EXCEPTION( frame_eea0b96afd566fff47c19baa8c48c699 );
369 #endif
370  
371     // Put the previous frame back on top.
372     popFrameStack();
373  
374     goto try_return_handler_1; 345     goto try_return_handler_1;
n 375   n
376     frame_exception_exit_1:;
377  
378 #if 0
379     RESTORE_FRAME_EXCEPTION( frame_eea0b96afd566fff47c19baa8c48c699 );
380 #endif
381  
382     if ( exception_tb == NULL )
383     {
384         exception_tb = MAKE_TRACEBACK( frame_eea0b96afd566fff47c19baa8c48c699, exception_lineno );
385     }
386     else if ( exception_tb->tb_frame != &frame_eea0b96afd566fff47c19baa8c48c699->m_frame )
387     {
388         exception_tb = ADD_TRACEBACK( exception_tb, frame_eea0b96afd566fff47c19baa8c48c699, exception_lineno );
389     }
390  
391     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_eea0b96afd566fff47c19baa8c48c699, type_description ,var_local_value, var_s, var_t );
392  
393     // Release cached frame.
394     if ( frame_eea0b96afd566fff47c19baa8c48c699 == cache_frame_eea0b96afd566fff47c19baa8c48c699 )
395     {
396         Py_DECREF( frame_eea0b96afd566fff47c19baa8c48c699 );
397     }
398     cache_frame_eea0b96afd566fff47c19baa8c48c699 = NULL;
399  
400     assertFrameObject( frame_eea0b96afd566fff47c19baa8c48c699 );
401  
402  
403     // Put the previous frame back on top.
404     popFrameStack();
405  
406     // Return the error.
407     goto try_except_handler_1;
408  
409     frame_no_exception_1:;
410  
411     // tried codes exits in all cases 346     // tried codes exits in all cases
412     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 347     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
413     return NULL; 348     return NULL;
414     // Return handler code: 349     // Return handler code:
415     try_return_handler_1:; 350     try_return_handler_1:;
n n 351     CHECK_OBJECT( (PyObject *)var_local_value );
416     Py_XDECREF( var_local_value ); 352     Py_DECREF( var_local_value );
417     var_local_value = NULL; 353     var_local_value = NULL;
418 354
419     Py_XDECREF( var_s ); 355     Py_XDECREF( var_s );
420     var_s = NULL; 356     var_s = NULL;
421 357
437     Py_XDECREF( var_local_value ); 373     Py_XDECREF( var_local_value );
438     var_local_value = NULL; 374     var_local_value = NULL;
439 375
440     Py_XDECREF( var_s ); 376     Py_XDECREF( var_s );
441     var_s = NULL; 377     var_s = NULL;
t 442   t
443     Py_XDECREF( var_t );
444     var_t = NULL;
445 378
446     // Re-raise. 379     // Re-raise.
447     exception_type = exception_keeper_type_1; 380     exception_type = exception_keeper_type_1;
448     exception_value = exception_keeper_value_1; 381     exception_value = exception_keeper_value_1;
449     exception_tb = exception_keeper_tb_1; 382     exception_tb = exception_keeper_tb_1;