Construct OperationListIntegerIndexLookup

Performance Diagrams

Construct OperationListIntegerIndexLookup 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)868455774.3076923076923257.00000000000006CPython 2.75999934198.15384615384616333.3898083911831Nuitka (historic)5349939322.0351.88514032614273Nuitka (master)5350113445.8461538461538351.88018922997014Nuitka (develop)5350119569.6923076923077351.8800185025159Nuitka (factory)Construct OperationListIntegerIndexLookupTicks Construct OperationListIntegerIndexLookup 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1198540273.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)5640861319.0000000000001387.8119401771486Nuitka (master)5649042441.69230769230774387.64326406920173Nuitka (develop)5649324564.3846153846155387.637449784586Nuitka (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

for x in xrange(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

for x in xrange(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 for x in xrange(50000): 38 for x in xrange(50000):
39     calledRepeatedly() 39     calledRepeatedly()

Context Diff of Generated Code


Construct
Baseline
148     PyTracebackObject *exception_keeper_tb_1; 148     PyTracebackObject *exception_keeper_tb_1;
149     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 149     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
150     PyObject *tmp_assign_source_1; 150     PyObject *tmp_assign_source_1;
151     PyObject *tmp_assign_source_2; 151     PyObject *tmp_assign_source_2;
152     PyObject *tmp_assign_source_3; 152     PyObject *tmp_assign_source_3;
n 153     PyObject *tmp_assign_source_4; n
154     PyObject *tmp_frame_locals; 153     PyObject *tmp_frame_locals;
155     PyObject *tmp_return_value; 154     PyObject *tmp_return_value;
n 156     PyObject *tmp_subscribed_name_1; n
157     PyObject *tmp_subscript_name_1;
158     PyObject *tmp_tuple_element_1; 155     PyObject *tmp_tuple_element_1;
159     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 156     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
160     static PyFrameObject *cache_frame_function = NULL; 157     static PyFrameObject *cache_frame_function = NULL;
161 158
162     PyFrameObject *frame_function; 159     PyFrameObject *frame_function;
274 271
275     assert( var_t == NULL ); 272     assert( var_t == NULL );
276     Py_INCREF( tmp_assign_source_3 ); 273     Py_INCREF( tmp_assign_source_3 );
277     var_t = tmp_assign_source_3; 274     var_t = tmp_assign_source_3;
278 275
n 279     tmp_subscribed_name_1 = var_s; n
280  
281     tmp_subscript_name_1 = var_t;
282  
283     tmp_assign_source_4 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 );
284     if ( tmp_assign_source_4 == NULL )
285     {
286         assert( ERROR_OCCURRED() );
287  
288         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
289  
290  
291         exception_lineno = 33;
292         goto frame_exception_exit_1;
293     }
294     {
295         PyObject *old = var_t;
296         var_t = tmp_assign_source_4;
297         Py_XDECREF( old );
298     }
299  
300     tmp_return_value = PyTuple_New( 3 );
301     tmp_tuple_element_1 = var_s;
302  
303     if ( tmp_tuple_element_1 == NULL )
304     {
305         Py_DECREF( tmp_return_value );
306         exception_type = PyExc_UnboundLocalError;
307         Py_INCREF( exception_type );
308         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
309         exception_tb = NULL;
310         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
311         CHAIN_EXCEPTION( exception_value );
312  
313         exception_lineno = 36;
314         goto frame_exception_exit_1;
315     }
316  
317     Py_INCREF( tmp_tuple_element_1 );
318     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
319     tmp_tuple_element_1 = var_t;
320  
321     Py_INCREF( tmp_tuple_element_1 );
322     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
323     tmp_tuple_element_1 = var_local_value;
324  
325     if ( tmp_tuple_element_1 == NULL )
326     {
327         Py_DECREF( tmp_return_value );
328         exception_type = PyExc_UnboundLocalError;
329         Py_INCREF( exception_type );
330         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
331         exception_tb = NULL;
332         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
333         CHAIN_EXCEPTION( exception_value );
334  
335         exception_lineno = 36;
336         goto frame_exception_exit_1;
337     }
338  
339     Py_INCREF( tmp_tuple_element_1 );
340     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
341     goto frame_return_exit_1;
342 276
343 #if 0 277 #if 0
344     RESTORE_FRAME_EXCEPTION( frame_function ); 278     RESTORE_FRAME_EXCEPTION( frame_function );
345 #endif 279 #endif
346     // Put the previous frame back on top. 280     // Put the previous frame back on top.
348 #if PYTHON_VERSION >= 340 282 #if PYTHON_VERSION >= 340
349     frame_function->f_executing -= 1; 283     frame_function->f_executing -= 1;
350 #endif 284 #endif
351     Py_DECREF( frame_function ); 285     Py_DECREF( frame_function );
352     goto frame_no_exception_1; 286     goto frame_no_exception_1;
n 353   n
354     frame_return_exit_1:;
355 #if 0
356     RESTORE_FRAME_EXCEPTION( frame_function );
357 #endif
358     popFrameStack();
359 #if PYTHON_VERSION >= 340
360     frame_function->f_executing -= 1;
361 #endif
362     Py_DECREF( frame_function );
363     goto try_return_handler_1;
364 287
365     frame_exception_exit_1:; 288     frame_exception_exit_1:;
366 #if 0 289 #if 0
367     RESTORE_FRAME_EXCEPTION( frame_function ); 290     RESTORE_FRAME_EXCEPTION( frame_function );
368 #endif 291 #endif
437     // Return the error. 360     // Return the error.
438     goto try_except_handler_1; 361     goto try_except_handler_1;
439 362
440     frame_no_exception_1:; 363     frame_no_exception_1:;
441 364
n n 365     tmp_return_value = PyTuple_New( 3 );
366     tmp_tuple_element_1 = var_s;
367  
368     Py_INCREF( tmp_tuple_element_1 );
369     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
370     tmp_tuple_element_1 = var_t;
371  
372     Py_INCREF( tmp_tuple_element_1 );
373     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
374     tmp_tuple_element_1 = var_local_value;
375  
376     Py_INCREF( tmp_tuple_element_1 );
377     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
378     goto try_return_handler_1;
442     // tried codes exits in all cases 379     // tried codes exits in all cases
443     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 380     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
444     return NULL; 381     return NULL;
445     // Return handler code: 382     // Return handler code:
446     try_return_handler_1:; 383     try_return_handler_1:;
n n 384     CHECK_OBJECT( (PyObject *)var_local_value );
447     Py_XDECREF( var_local_value ); 385     Py_DECREF( var_local_value );
448     var_local_value = NULL; 386     var_local_value = NULL;
449 387
450     Py_XDECREF( var_s ); 388     Py_XDECREF( var_s );
451     var_s = NULL; 389     var_s = NULL;
452 390
468     Py_XDECREF( var_local_value ); 406     Py_XDECREF( var_local_value );
469     var_local_value = NULL; 407     var_local_value = NULL;
470 408
471     Py_XDECREF( var_s ); 409     Py_XDECREF( var_s );
472     var_s = NULL; 410     var_s = NULL;
t 473   t
474     Py_XDECREF( var_t );
475     var_t = NULL;
476 411
477     // Re-raise. 412     // Re-raise.
478     exception_type = exception_keeper_type_1; 413     exception_type = exception_keeper_type_1;
479     exception_value = exception_keeper_value_1; 414     exception_value = exception_keeper_value_1;
480     exception_tb = exception_keeper_tb_1; 415     exception_tb = exception_keeper_tb_1;