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)24155273441.69230769230774408.3033484767352Nuitka (develop)24195878564.3846153846155408.14228849917214Nuitka (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)35960004441.69230769230774297.33415745217644Nuitka (develop)35913631564.3846153846155297.6008166507472Nuitka (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_left_name_1; 141     PyObject *tmp_left_name_1;
n 143     PyObject *tmp_left_name_2; n
144     bool tmp_result;
145     PyObject *tmp_return_value; 142     PyObject *tmp_return_value;
146     PyObject *tmp_right_name_1; 143     PyObject *tmp_right_name_1;
n 147     PyObject *tmp_right_name_2; n
148     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 144     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
149     static struct Nuitka_FrameObject *cache_frame_function = NULL; 145     static struct Nuitka_FrameObject *cache_frame_function = NULL;
150 146
151     struct Nuitka_FrameObject *frame_function; 147     struct Nuitka_FrameObject *frame_function;
152 148
228         type_description = "oo"; 224         type_description = "oo";
229         goto frame_exception_exit_1; 225         goto frame_exception_exit_1;
230     } 226     }
231     assert( var_s == NULL ); 227     assert( var_s == NULL );
232     var_s = tmp_assign_source_2; 228     var_s = tmp_assign_source_2;
n 233   n
234     tmp_left_name_2 = var_s;
235  
236     tmp_right_name_2 = var_additiv;
237  
238     if ( tmp_right_name_2 == NULL )
239     {
240  
241         exception_type = PyExc_UnboundLocalError;
242         Py_INCREF( exception_type );
243         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "additiv" );
244         exception_tb = NULL;
245         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
246         CHAIN_EXCEPTION( exception_value );
247  
248         exception_lineno = 36;
249         type_description = "oo";
250         goto frame_exception_exit_1;
251     }
252  
253     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
254     tmp_assign_source_3 = tmp_left_name_2;
255     if ( tmp_result == false )
256     {
257         assert( ERROR_OCCURRED() );
258  
259         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
260  
261  
262         exception_lineno = 36;
263         type_description = "oo";
264         goto frame_exception_exit_1;
265     }
266     var_s = tmp_assign_source_3;
267 229
268 230
269 #if 0 231 #if 0
270     RESTORE_FRAME_EXCEPTION( frame_function ); 232     RESTORE_FRAME_EXCEPTION( frame_function );
271 #endif 233 #endif
335     exception_keeper_lineno_1 = exception_lineno; 297     exception_keeper_lineno_1 = exception_lineno;
336     exception_type = NULL; 298     exception_type = NULL;
337     exception_value = NULL; 299     exception_value = NULL;
338     exception_tb = NULL; 300     exception_tb = NULL;
339     exception_lineno = -1; 301     exception_lineno = -1;
t 340   t
341     Py_XDECREF( var_s );
342     var_s = NULL;
343 302
344     Py_XDECREF( var_additiv ); 303     Py_XDECREF( var_additiv );
345     var_additiv = NULL; 304     var_additiv = NULL;
346 305
347     // Re-raise. 306     // Re-raise.