Construct InplaceOperationStringAdd

Performance Diagrams

Construct InplaceOperationStringAdd 004000000400000080000008000000120000001200000016000000160000002000000020000000240000002400000028000000280000003200000032000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)3548467288.95192307692307257.0CPython 2.724707463242.31730769230768332.0525225966689Nuitka (master)24715517395.6826923076923331.99643451143334Nuitka (develop)24629747549.0480769230769332.5937371027737Nuitka (factory)Construct InplaceOperationStringAddTicks Construct InplaceOperationStringAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)4136980588.95192307692307257.0CPython 3.529631363242.31730769230768327.11755577807014Nuitka (master)29717735395.6826923076923326.60162755457475Nuitka (develop)29738037549.0480769230769326.48035706421445Nuitka (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

import itertools
for x in itertools.repeat(None, 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

import itertools
for x in itertools.repeat(None, 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 import itertools 41 import itertools
42 for x in itertools.repeat(None, 50000): 42 for x in itertools.repeat(None, 50000):

Context Diff of Generated Code


Construct
Baseline
137     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 137     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
138     PyObject *exception_type = NULL; 138     PyObject *exception_type = NULL;
139     PyObject *exception_value = NULL; 139     PyObject *exception_value = NULL;
140     PyTracebackObject *exception_tb = NULL; 140     PyTracebackObject *exception_tb = NULL;
141     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 141     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 142     bool tmp_result; n
143     static struct Nuitka_FrameObject *cache_frame_5601aee4f6b87dae806c766d5fe354e4 = NULL; 142     static struct Nuitka_FrameObject *cache_frame_5601aee4f6b87dae806c766d5fe354e4 = NULL;
144     PyObject *tmp_return_value = NULL; 143     PyObject *tmp_return_value = NULL;
145     PyObject *exception_keeper_type_1; 144     PyObject *exception_keeper_type_1;
146     PyObject *exception_keeper_value_1; 145     PyObject *exception_keeper_value_1;
147     PyTracebackObject *exception_keeper_tb_1; 146     PyTracebackObject *exception_keeper_tb_1;
233         type_description_1 = "oo"; 232         type_description_1 = "oo";
234         goto frame_exception_exit_1; 233         goto frame_exception_exit_1;
235     } 234     }
236     assert( var_s == NULL ); 235     assert( var_s == NULL );
237     var_s = tmp_assign_source_2; 236     var_s = tmp_assign_source_2;
n 238   n
239     }
240     {
241     PyObject *tmp_assign_source_3;
242     PyObject *tmp_left_name_2;
243     PyObject *tmp_right_name_2;
244     tmp_left_name_2 = var_s;
245  
246     CHECK_OBJECT( tmp_left_name_2 );
247     tmp_right_name_2 = var_additiv;
248  
249     if ( tmp_right_name_2 == NULL )
250     {
251  
252         exception_type = PyExc_UnboundLocalError;
253         Py_INCREF( exception_type );
254         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "additiv" );
255         exception_tb = NULL;
256         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
257         CHAIN_EXCEPTION( exception_value );
258  
259         exception_lineno = 36;
260         type_description_1 = "oo";
261         goto frame_exception_exit_1;
262     }
263  
264     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
265     tmp_assign_source_3 = tmp_left_name_2;
266     if ( tmp_result == false )
267     {
268         assert( ERROR_OCCURRED() );
269  
270         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
271  
272  
273         exception_lineno = 36;
274         type_description_1 = "oo";
275         goto frame_exception_exit_1;
276     }
277     var_s = tmp_assign_source_3;
278 237
279     } 238     }
280 239
281 #if 0 240 #if 0
282     RESTORE_FRAME_EXCEPTION( frame_5601aee4f6b87dae806c766d5fe354e4 ); 241     RESTORE_FRAME_EXCEPTION( frame_5601aee4f6b87dae806c766d5fe354e4 );
363     exception_type = NULL; 322     exception_type = NULL;
364     exception_value = NULL; 323     exception_value = NULL;
365     exception_tb = NULL; 324     exception_tb = NULL;
366     exception_lineno = 0; 325     exception_lineno = 0;
367 326
t 368     { t
369     Py_XDECREF( var_s );
370     var_s = NULL;
371  
372     }
373     { 327     {
374     Py_XDECREF( var_additiv ); 328     Py_XDECREF( var_additiv );
375     var_additiv = NULL; 329     var_additiv = NULL;
376 330
377     } 331     }