Construct OperationListIntegerIndexLookup

Performance Diagrams

Construct OperationListIntegerIndexLookup 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)868455774.3076923076923257.00000000000006CPython 2.75999934198.15384615384616333.3898083911831Nuitka (historic)5199887322.0356.1548063197343Nuitka (master)5349998445.8461538461538351.8834615061761Nuitka (develop)5349980569.6923076923077351.88397368853884Nuitka (factory)Construct OperationListIntegerIndexLookupTicks Construct OperationListIntegerIndexLookup 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1198540273.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)5651604319.0000000000001387.5904406749272Nuitka (master)5650293441.69230769230774387.61747091298105Nuitka (develop)5650269564.3846153846155387.6179657457143Nuitka (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
147     PyTracebackObject *exception_keeper_tb_1; 147     PyTracebackObject *exception_keeper_tb_1;
148     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 148     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
149     PyObject *tmp_assign_source_1; 149     PyObject *tmp_assign_source_1;
150     PyObject *tmp_assign_source_2; 150     PyObject *tmp_assign_source_2;
151     PyObject *tmp_assign_source_3; 151     PyObject *tmp_assign_source_3;
n 152     PyObject *tmp_assign_source_4; n
153     PyObject *tmp_return_value; 152     PyObject *tmp_return_value;
n 154     PyObject *tmp_subscribed_name_1; n
155     PyObject *tmp_subscript_name_1;
156     PyObject *tmp_tuple_element_1; 153     PyObject *tmp_tuple_element_1;
157     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 154     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
158     static struct Nuitka_FrameObject *cache_frame_585268cfbf550fdb643c5b6994f14544 = NULL; 155     static struct Nuitka_FrameObject *cache_frame_585268cfbf550fdb643c5b6994f14544 = NULL;
159 156
160     struct Nuitka_FrameObject *frame_585268cfbf550fdb643c5b6994f14544; 157     struct Nuitka_FrameObject *frame_585268cfbf550fdb643c5b6994f14544;
272 269
273     assert( var_t == NULL ); 270     assert( var_t == NULL );
274     Py_INCREF( tmp_assign_source_3 ); 271     Py_INCREF( tmp_assign_source_3 );
275     var_t = tmp_assign_source_3; 272     var_t = tmp_assign_source_3;
276 273
n 277     tmp_subscribed_name_1 = var_s; n
278 274
n 279     CHECK_OBJECT( tmp_subscribed_name_1 ); n 275 #if 0
280     tmp_subscript_name_1 = var_t; 276     RESTORE_FRAME_EXCEPTION( frame_585268cfbf550fdb643c5b6994f14544 );
277 #endif
281 278
n 282     CHECK_OBJECT( tmp_subscript_name_1 ); n 279     // Put the previous frame back on top.
283     tmp_assign_source_4 = LOOKUP_SUBSCRIPT( tmp_subscribed_name_1, tmp_subscript_name_1 ); 280     popFrameStack();
284     if ( tmp_assign_source_4 == NULL )
285     {
286         assert( ERROR_OCCURRED() );
287 281
n 288         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); n 282     goto frame_no_exception_1;
289 283
n 290   n
291         exception_lineno = 33;
292         type_description = "ooo";
293         goto frame_exception_exit_1; 284     frame_exception_exit_1:;
285  
286 #if 0
287     RESTORE_FRAME_EXCEPTION( frame_585268cfbf550fdb643c5b6994f14544 );
288 #endif
289  
290     if ( exception_tb == NULL )
294     } 291     {
292         exception_tb = MAKE_TRACEBACK( frame_585268cfbf550fdb643c5b6994f14544, exception_lineno );
295     { 293     }
296         PyObject *old = var_t; 294     else if ( exception_tb->tb_frame != &frame_585268cfbf550fdb643c5b6994f14544->m_frame )
297         var_t = tmp_assign_source_4;
298         Py_XDECREF( old );
299     } 295     {
296         exception_tb = ADD_TRACEBACK( exception_tb, frame_585268cfbf550fdb643c5b6994f14544, exception_lineno );
297     }
298  
299     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_585268cfbf550fdb643c5b6994f14544, type_description ,var_local_value, var_s, var_t );
300  
301     // Release cached frame.
302     if ( frame_585268cfbf550fdb643c5b6994f14544 == cache_frame_585268cfbf550fdb643c5b6994f14544 )
303     {
304         Py_DECREF( frame_585268cfbf550fdb643c5b6994f14544 );
305     }
306     cache_frame_585268cfbf550fdb643c5b6994f14544 = NULL;
307  
308     assertFrameObject( frame_585268cfbf550fdb643c5b6994f14544 );
309  
310  
311     // Put the previous frame back on top.
312     popFrameStack();
313  
314     // Return the error.
315     goto try_except_handler_1;
316  
317     frame_no_exception_1:;
300 318
301     tmp_return_value = PyTuple_New( 3 ); 319     tmp_return_value = PyTuple_New( 3 );
302     tmp_tuple_element_1 = var_s; 320     tmp_tuple_element_1 = var_s;
303 321
n 304     if ( tmp_tuple_element_1 == NULL ) n 322     CHECK_OBJECT( tmp_tuple_element_1 );
305     {
306         Py_DECREF( tmp_return_value );
307         exception_type = PyExc_UnboundLocalError;
308         Py_INCREF( exception_type );
309         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "s" );
310         exception_tb = NULL;
311         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
312         CHAIN_EXCEPTION( exception_value );
313  
314         exception_lineno = 36;
315         type_description = "ooo";
316         goto frame_exception_exit_1;
317     }
318  
319     Py_INCREF( tmp_tuple_element_1 ); 323     Py_INCREF( tmp_tuple_element_1 );
320     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 ); 324     PyTuple_SET_ITEM( tmp_return_value, 0, tmp_tuple_element_1 );
321     tmp_tuple_element_1 = var_t; 325     tmp_tuple_element_1 = var_t;
322 326
323     CHECK_OBJECT( tmp_tuple_element_1 ); 327     CHECK_OBJECT( tmp_tuple_element_1 );
324     Py_INCREF( tmp_tuple_element_1 ); 328     Py_INCREF( tmp_tuple_element_1 );
325     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 ); 329     PyTuple_SET_ITEM( tmp_return_value, 1, tmp_tuple_element_1 );
326     tmp_tuple_element_1 = var_local_value; 330     tmp_tuple_element_1 = var_local_value;
327 331
n 328     if ( tmp_tuple_element_1 == NULL ) n 332     CHECK_OBJECT( tmp_tuple_element_1 );
329     {
330         Py_DECREF( tmp_return_value );
331         exception_type = PyExc_UnboundLocalError;
332         Py_INCREF( exception_type );
333         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "local_value" );
334         exception_tb = NULL;
335         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
336         CHAIN_EXCEPTION( exception_value );
337  
338         exception_lineno = 36;
339         type_description = "ooo";
340         goto frame_exception_exit_1;
341     }
342  
343     Py_INCREF( tmp_tuple_element_1 ); 333     Py_INCREF( tmp_tuple_element_1 );
344     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 ); 334     PyTuple_SET_ITEM( tmp_return_value, 2, tmp_tuple_element_1 );
n 345     goto frame_return_exit_1; n
346  
347 #if 0
348     RESTORE_FRAME_EXCEPTION( frame_585268cfbf550fdb643c5b6994f14544 );
349 #endif
350  
351     // Put the previous frame back on top.
352     popFrameStack();
353  
354     goto frame_no_exception_1;
355  
356     frame_return_exit_1:;
357 #if 0
358     RESTORE_FRAME_EXCEPTION( frame_585268cfbf550fdb643c5b6994f14544 );
359 #endif
360  
361     // Put the previous frame back on top.
362     popFrameStack();
363  
364     goto try_return_handler_1; 335     goto try_return_handler_1;
n 365   n
366     frame_exception_exit_1:;
367  
368 #if 0
369     RESTORE_FRAME_EXCEPTION( frame_585268cfbf550fdb643c5b6994f14544 );
370 #endif
371  
372     if ( exception_tb == NULL )
373     {
374         exception_tb = MAKE_TRACEBACK( frame_585268cfbf550fdb643c5b6994f14544, exception_lineno );
375     }
376     else if ( exception_tb->tb_frame != &frame_585268cfbf550fdb643c5b6994f14544->m_frame )
377     {
378         exception_tb = ADD_TRACEBACK( exception_tb, frame_585268cfbf550fdb643c5b6994f14544, exception_lineno );
379     }
380  
381     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_585268cfbf550fdb643c5b6994f14544, type_description ,var_local_value, var_s, var_t );
382  
383     // Release cached frame.
384     if ( frame_585268cfbf550fdb643c5b6994f14544 == cache_frame_585268cfbf550fdb643c5b6994f14544 )
385     {
386         Py_DECREF( frame_585268cfbf550fdb643c5b6994f14544 );
387     }
388     cache_frame_585268cfbf550fdb643c5b6994f14544 = NULL;
389  
390     assertFrameObject( frame_585268cfbf550fdb643c5b6994f14544 );
391  
392  
393     // Put the previous frame back on top.
394     popFrameStack();
395  
396     // Return the error.
397     goto try_except_handler_1;
398  
399     frame_no_exception_1:;
400  
401     // tried codes exits in all cases 336     // tried codes exits in all cases
402     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 337     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
403     return NULL; 338     return NULL;
404     // Return handler code: 339     // Return handler code:
405     try_return_handler_1:; 340     try_return_handler_1:;
n n 341     CHECK_OBJECT( (PyObject *)var_local_value );
406     Py_XDECREF( var_local_value ); 342     Py_DECREF( var_local_value );
407     var_local_value = NULL; 343     var_local_value = NULL;
408 344
409     Py_XDECREF( var_s ); 345     Py_XDECREF( var_s );
410     var_s = NULL; 346     var_s = NULL;
411 347
427     Py_XDECREF( var_local_value ); 363     Py_XDECREF( var_local_value );
428     var_local_value = NULL; 364     var_local_value = NULL;
429 365
430     Py_XDECREF( var_s ); 366     Py_XDECREF( var_s );
431     var_s = NULL; 367     var_s = NULL;
t 432   t
433     Py_XDECREF( var_t );
434     var_t = NULL;
435 368
436     // Re-raise. 369     // Re-raise.
437     exception_type = exception_keeper_type_1; 370     exception_type = exception_keeper_type_1;
438     exception_value = exception_keeper_value_1; 371     exception_value = exception_keeper_value_1;
439     exception_tb = exception_keeper_tb_1; 372     exception_tb = exception_keeper_tb_1;