Construct OperationListIntegerIndexLookup

Performance Diagrams

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