Construct InplaceOperationStringAdd

Performance Diagrams

Construct InplaceOperationStringAdd 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)723086989.78846153846155257.0CPython 2.75350006244.59615384615387321.2786065760348Nuitka (master)5349988399.4038461538462321.27922172712147Nuitka (develop)5350012554.2115384615385321.27840152567256Nuitka (factory)Construct InplaceOperationStringAddTicks Construct InplaceOperationStringAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1721337288.95192307692307257.00000000000006CPython 3.515929988242.31730769230768275.42427682206784Nuitka (master)15930060395.6826923076923275.4232431891636Nuitka (develop)5660006549.0480769230769422.86026739515694Nuitka (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
243             assert(ERROR_OCCURRED()); 243             assert(ERROR_OCCURRED());
244 244
245             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 245             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
246 246
247 247
n 248             exception_lineno = 37; n
249             type_description_1 = "oo";
250             goto frame_exception_exit_1;
251         }
252         tmp_assign_source_3 = tmp_left_name_2;
253         var_s = tmp_assign_source_3;
254  
255     }
256     {
257         PyObject *tmp_assign_source_4;
258         PyObject *tmp_left_name_3;
259         PyObject *tmp_right_name_3;
260         CHECK_OBJECT(var_s);
261         tmp_left_name_3 = var_s;
262         CHECK_OBJECT(var_additiv);
263         tmp_right_name_3 = var_additiv;
264         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_3, tmp_right_name_3);
265         if (tmp_result == false) {
266             assert(ERROR_OCCURRED());
267  
268             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
269  
270  
271             exception_lineno = 41; 248             exception_lineno = 41;
272             type_description_1 = "oo"; 249             type_description_1 = "oo";
273             goto frame_exception_exit_1; 250             goto frame_exception_exit_1;
274         } 251         }
t 275         tmp_assign_source_4 = tmp_left_name_3; t 252         tmp_assign_source_3 = tmp_left_name_2;
276         var_s = tmp_assign_source_4; 253         var_s = tmp_assign_source_3;
277 254
278     } 255     }
279 256
280 #if 0 257 #if 0
281     RESTORE_FRAME_EXCEPTION(frame_e7635edabc8a674a125b49186dce393b); 258     RESTORE_FRAME_EXCEPTION(frame_e7635edabc8a674a125b49186dce393b);