Construct InplaceOperationStringAdd

Performance Diagrams

Construct InplaceOperationStringAdd 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)3357621473.61538461538461370.9351291420962CPython 2.762300519196.30769230769232257.0Nuitka (historic)24166317319.0000000000001408.25954238408144Nuitka (master)24155783441.69230769230774408.3013255586572Nuitka (develop)24155823564.3846153846155408.3011668984158Nuitka (factory)Construct InplaceOperationStringAddTicks Construct InplaceOperationStringAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)4297426073.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)35939830319.0000000000001297.4501642378484Nuitka (master)35961961441.69230769230774297.3229040924283Nuitka (develop)35952045564.3846153846155297.3799241819853Nuitka (factory)Construct InplaceOperationStringAddTicks

Source Code with Construct

module_value1 = 5

additiv_global = '*' * 1000

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable s anyway
    s = '2'

    additiv = additiv_global

    s += additiv
# construct_begin
    s += additiv
# construct_end

    return s

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

module_value1 = 5

additiv_global = '*' * 1000

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable s anyway
    s = '2'

    additiv = additiv_global

    s += additiv
# construct_begin



    return s

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
31 31
32     additiv = additiv_global 32     additiv = additiv_global
33 33
34     s += additiv 34     s += additiv
35 # construct_begin 35 # construct_begin
t 36     s += additiv t 36  
37 # construct_end 37  
38 38
39     return s 39     return s
40 40
41 for x in xrange(50000): 41 for x in xrange(50000):
42     calledRepeatedly() 42     calledRepeatedly()

Context Diff of Generated Code


Construct
Baseline
136     PyObject *exception_keeper_value_1; 136     PyObject *exception_keeper_value_1;
137     PyTracebackObject *exception_keeper_tb_1; 137     PyTracebackObject *exception_keeper_tb_1;
138     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 138     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
139     PyObject *tmp_assign_source_1; 139     PyObject *tmp_assign_source_1;
140     PyObject *tmp_assign_source_2; 140     PyObject *tmp_assign_source_2;
n 141     PyObject *tmp_assign_source_3; n
142     PyObject *tmp_frame_locals; 141     PyObject *tmp_frame_locals;
143     PyObject *tmp_left_name_1; 142     PyObject *tmp_left_name_1;
n 144     PyObject *tmp_left_name_2; n
145     bool tmp_result;
146     PyObject *tmp_return_value; 143     PyObject *tmp_return_value;
147     PyObject *tmp_right_name_1; 144     PyObject *tmp_right_name_1;
n 148     PyObject *tmp_right_name_2; n
149     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 145     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
150     static PyFrameObject *cache_frame_function = NULL; 146     static PyFrameObject *cache_frame_function = NULL;
151 147
152     PyFrameObject *frame_function; 148     PyFrameObject *frame_function;
153 149
230         exception_lineno = 34; 226         exception_lineno = 34;
231         goto frame_exception_exit_1; 227         goto frame_exception_exit_1;
232     } 228     }
233     assert( var_s == NULL ); 229     assert( var_s == NULL );
234     var_s = tmp_assign_source_2; 230     var_s = tmp_assign_source_2;
n 235   n
236     tmp_left_name_2 = var_s;
237  
238     tmp_right_name_2 = var_additiv;
239  
240     if ( tmp_right_name_2 == NULL )
241     {
242  
243         exception_type = PyExc_UnboundLocalError;
244         Py_INCREF( exception_type );
245         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "additiv" );
246         exception_tb = NULL;
247         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
248         CHAIN_EXCEPTION( exception_value );
249  
250         exception_lineno = 36;
251         goto frame_exception_exit_1;
252     }
253  
254     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
255     tmp_assign_source_3 = tmp_left_name_2;
256     if ( tmp_result == false )
257     {
258         assert( ERROR_OCCURRED() );
259  
260         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
261  
262  
263         exception_lineno = 36;
264         goto frame_exception_exit_1;
265     }
266     var_s = tmp_assign_source_3;
267 231
268 232
269 #if 0 233 #if 0
270     RESTORE_FRAME_EXCEPTION( frame_function ); 234     RESTORE_FRAME_EXCEPTION( frame_function );
271 #endif 235 #endif
368     exception_keeper_lineno_1 = exception_lineno; 332     exception_keeper_lineno_1 = exception_lineno;
369     exception_type = NULL; 333     exception_type = NULL;
370     exception_value = NULL; 334     exception_value = NULL;
371     exception_tb = NULL; 335     exception_tb = NULL;
372     exception_lineno = -1; 336     exception_lineno = -1;
t 373   t
374     Py_XDECREF( var_s );
375     var_s = NULL;
376 337
377     Py_XDECREF( var_additiv ); 338     Py_XDECREF( var_additiv );
378     var_additiv = NULL; 339     var_additiv = NULL;
379 340
380     // Re-raise. 341     // Re-raise.