Construct InplaceOperationStringAdd

Performance Diagrams

Construct InplaceOperationStringAdd 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)711245589.78846153846155257.0CPython 2.75099994244.59615384615387326.92101518230504Nuitka (master)5099992399.4038461538462326.92108467037485Nuitka (develop)5099946554.2115384615385326.9226828959794Nuitka (factory)Construct InplaceOperationStringAddTicks Construct InplaceOperationStringAdd 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)804310788.95192307692307307.3793777990559CPython 3.59909862242.31730769230768261.71817692178104Nuitka (master)10102754395.6826923076923257.0Nuitka (develop)10074348549.0480769230769257.6948164446432Nuitka (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'

    # Add an unknown, making 's' an unknown.
    additiv = additiv_global
    s += additiv

# construct_begin
    s += additiv
# construct_end

    # Prevent optimization into direct return.
    s += additiv

    return s

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

    # Add an unknown, making 's' an unknown.
    additiv = additiv_global
    s += additiv

# construct_begin



    # Prevent optimization into direct return.
    s += additiv

    return s

import itertools
for x in itertools.repeat(None, 10000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
32     # Add an unknown, making 's' an unknown. 32     # Add an unknown, making 's' an unknown.
33     additiv = additiv_global 33     additiv = additiv_global
34     s += additiv 34     s += additiv
35 35
36 # construct_begin 36 # construct_begin
t 37     s += additiv t 37  
38 # construct_end 38  
39 39
40     # Prevent optimization into direct return. 40     # Prevent optimization into direct return.
41     s += additiv 41     s += additiv
42 42
43     return s 43     return s

Context Diff of Generated Code


Construct
Baseline
252         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "additiv" ); 252         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "additiv" );
253         exception_tb = NULL; 253         exception_tb = NULL;
254         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 254         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
255         CHAIN_EXCEPTION( exception_value ); 255         CHAIN_EXCEPTION( exception_value );
256 256
n 257         exception_lineno = 37; n 257         exception_lineno = 41;
258         type_description_1 = "oo"; 258         type_description_1 = "oo";
259         goto frame_exception_exit_1; 259         goto frame_exception_exit_1;
260     } 260     }
261 261
262     tmp_right_name_2 = var_additiv; 262     tmp_right_name_2 = var_additiv;
266         assert( ERROR_OCCURRED() ); 266         assert( ERROR_OCCURRED() );
267 267
268         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 268         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
269 269
270 270
n 271         exception_lineno = 37; n
272         type_description_1 = "oo";
273         goto frame_exception_exit_1;
274     }
275     tmp_assign_source_3 = tmp_left_name_2;
276     var_s = tmp_assign_source_3;
277  
278     }
279     {
280     PyObject *tmp_assign_source_4;
281     PyObject *tmp_left_name_3;
282     PyObject *tmp_right_name_3;
283     CHECK_OBJECT( var_s );
284     tmp_left_name_3 = var_s;
285     if ( var_additiv == NULL )
286     {
287  
288         exception_type = PyExc_UnboundLocalError;
289         Py_INCREF( exception_type );
290         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "additiv" );
291         exception_tb = NULL;
292         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
293         CHAIN_EXCEPTION( exception_value );
294  
295         exception_lineno = 41; 271         exception_lineno = 41;
296         type_description_1 = "oo"; 272         type_description_1 = "oo";
297         goto frame_exception_exit_1; 273         goto frame_exception_exit_1;
298     } 274     }
t 299   t
300     tmp_right_name_3 = var_additiv;
301     tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_3, tmp_right_name_3 );
302     if ( tmp_result == false )
303     {
304         assert( ERROR_OCCURRED() );
305  
306         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
307  
308  
309         exception_lineno = 41;
310         type_description_1 = "oo";
311         goto frame_exception_exit_1;
312     }
313     tmp_assign_source_4 = tmp_left_name_3; 275     tmp_assign_source_3 = tmp_left_name_2;
314     var_s = tmp_assign_source_4; 276     var_s = tmp_assign_source_3;
315 277
316     } 278     }
317 279
318 #if 0 280 #if 0
319     RESTORE_FRAME_EXCEPTION( frame_12c00c2e3c6596d412ecccb70580fa69 ); 281     RESTORE_FRAME_EXCEPTION( frame_12c00c2e3c6596d412ecccb70580fa69 );