Construct InplaceOperationStringAdd

Performance Diagrams

Construct InplaceOperationStringAdd 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)708271989.78846153846155257.0CPython 2.75020564244.59615384615387328.9483895890178Nuitka (master)5021268399.4038461538462328.9238270967363Nuitka (develop)5020414554.2115384615385328.95362307458913Nuitka (factory)Construct InplaceOperationStringAddTicks Construct InplaceOperationStringAdd 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)807272189.78846153846155295.12643649793677CPython 3.59540342244.59615384615387257.1322373889775Nuitka (master)9509258399.4038461538462257.93694901759477Nuitka (develop)9545450554.2115384615385257.0Nuitka (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             assert( ERROR_OCCURRED() ); 252             assert( ERROR_OCCURRED() );
253 253
254             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 254             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
255 255
256 256
n 257             exception_lineno = 37; n
258             type_description_1 = "oo";
259             goto frame_exception_exit_1;
260         }
261         tmp_assign_source_3 = tmp_left_name_2;
262         var_s = tmp_assign_source_3;
263  
264     }
265     {
266         PyObject *tmp_assign_source_4;
267         PyObject *tmp_left_name_3;
268         PyObject *tmp_right_name_3;
269         CHECK_OBJECT( var_s );
270         tmp_left_name_3 = var_s;
271         CHECK_OBJECT( var_additiv );
272         tmp_right_name_3 = var_additiv;
273         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_3, tmp_right_name_3 );
274         if ( tmp_result == false )
275         {
276             assert( ERROR_OCCURRED() );
277  
278             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
279  
280  
281             exception_lineno = 41; 257             exception_lineno = 41;
282             type_description_1 = "oo"; 258             type_description_1 = "oo";
283             goto frame_exception_exit_1; 259             goto frame_exception_exit_1;
284         } 260         }
t 285         tmp_assign_source_4 = tmp_left_name_3; t 261         tmp_assign_source_3 = tmp_left_name_2;
286         var_s = tmp_assign_source_4; 262         var_s = tmp_assign_source_3;
287 263
288     } 264     }
289 265
290 #if 0 266 #if 0
291     RESTORE_FRAME_EXCEPTION( frame_f35aba7f5619f9bd87e52da13a1b3bb5 ); 267     RESTORE_FRAME_EXCEPTION( frame_f35aba7f5619f9bd87e52da13a1b3bb5 );