Construct InplaceOperationStringAdd

Performance Diagrams

Construct InplaceOperationStringAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)4401000288.95192307692307257.0CPython 2.730521463242.31730769230768332.7379084619132Nuitka (main)30521318395.6826923076923332.7387226343545Nuitka (develop)30521318549.0480769230769332.7387226343545Nuitka (factory)Construct InplaceOperationStringAddTicks Construct InplaceOperationStringAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)4871085288.95192307692307257.0CPython 3.840070011242.31730769230768300.83591457434136Nuitka (main)40070011395.6826923076923300.83591457434136Nuitka (develop)40070011549.0480769230769300.83591457434136Nuitka (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
    s += additiv
    s += additiv
    s += additiv
    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     s += additiv 38  
39     s += additiv 39  
40     s += additiv 40  
41     s += additiv 41  
42 # construct_end 42  
43 43
44     # Prevent optimization into direct return. 44     # Prevent optimization into direct return.
45     s += additiv 45     s += additiv
46 46
47     return s 47     return s

Context Diff of Generated Code


Construct
Baseline
224             assert(ERROR_OCCURRED()); 224             assert(ERROR_OCCURRED());
225 225
226             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 226             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
227 227
228 228
n 229             exception_lineno = 37; n
230             type_description_1 = "oo";
231             goto frame_exception_exit_1;
232         }
233         tmp_assign_source_3 = tmp_left_value_2;
234         var_s = tmp_assign_source_3;
235  
236     }
237     {
238         PyObject *tmp_assign_source_4;
239         PyObject *tmp_left_value_3;
240         PyObject *tmp_right_value_3;
241         CHECK_OBJECT(var_s);
242         tmp_left_value_3 = var_s;
243         CHECK_OBJECT(var_additiv);
244         tmp_right_value_3 = var_additiv;
245         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_value_3, tmp_right_value_3);
246         if (tmp_result == false) {
247             assert(ERROR_OCCURRED());
248  
249             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
250  
251  
252             exception_lineno = 38;
253             type_description_1 = "oo";
254             goto frame_exception_exit_1;
255         }
256         tmp_assign_source_4 = tmp_left_value_3;
257         var_s = tmp_assign_source_4;
258  
259     }
260     {
261         PyObject *tmp_assign_source_5;
262         PyObject *tmp_left_value_4;
263         PyObject *tmp_right_value_4;
264         CHECK_OBJECT(var_s);
265         tmp_left_value_4 = var_s;
266         CHECK_OBJECT(var_additiv);
267         tmp_right_value_4 = var_additiv;
268         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_value_4, tmp_right_value_4);
269         if (tmp_result == false) {
270             assert(ERROR_OCCURRED());
271  
272             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
273  
274  
275             exception_lineno = 39;
276             type_description_1 = "oo";
277             goto frame_exception_exit_1;
278         }
279         tmp_assign_source_5 = tmp_left_value_4;
280         var_s = tmp_assign_source_5;
281  
282     }
283     {
284         PyObject *tmp_assign_source_6;
285         PyObject *tmp_left_value_5;
286         PyObject *tmp_right_value_5;
287         CHECK_OBJECT(var_s);
288         tmp_left_value_5 = var_s;
289         CHECK_OBJECT(var_additiv);
290         tmp_right_value_5 = var_additiv;
291         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_value_5, tmp_right_value_5);
292         if (tmp_result == false) {
293             assert(ERROR_OCCURRED());
294  
295             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
296  
297  
298             exception_lineno = 40;
299             type_description_1 = "oo";
300             goto frame_exception_exit_1;
301         }
302         tmp_assign_source_6 = tmp_left_value_5;
303         var_s = tmp_assign_source_6;
304  
305     }
306     {
307         PyObject *tmp_assign_source_7;
308         PyObject *tmp_left_value_6;
309         PyObject *tmp_right_value_6;
310         CHECK_OBJECT(var_s);
311         tmp_left_value_6 = var_s;
312         CHECK_OBJECT(var_additiv);
313         tmp_right_value_6 = var_additiv;
314         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_value_6, tmp_right_value_6);
315         if (tmp_result == false) {
316             assert(ERROR_OCCURRED());
317  
318             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
319  
320  
321             exception_lineno = 41;
322             type_description_1 = "oo";
323             goto frame_exception_exit_1;
324         }
325         tmp_assign_source_7 = tmp_left_value_6;
326         var_s = tmp_assign_source_7;
327  
328     }
329     {
330         PyObject *tmp_assign_source_8;
331         PyObject *tmp_left_value_7;
332         PyObject *tmp_right_value_7;
333         CHECK_OBJECT(var_s);
334         tmp_left_value_7 = var_s;
335         CHECK_OBJECT(var_additiv);
336         tmp_right_value_7 = var_additiv;
337         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_value_7, tmp_right_value_7);
338         if (tmp_result == false) {
339             assert(ERROR_OCCURRED());
340  
341             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
342  
343  
344             exception_lineno = 45; 229             exception_lineno = 45;
345             type_description_1 = "oo"; 230             type_description_1 = "oo";
346             goto frame_exception_exit_1; 231             goto frame_exception_exit_1;
347         } 232         }
t 348         tmp_assign_source_8 = tmp_left_value_7; t 233         tmp_assign_source_3 = tmp_left_value_2;
349         var_s = tmp_assign_source_8; 234         var_s = tmp_assign_source_3;
350 235
351     } 236     }
352 237
353 #if 0 238 #if 0
354     RESTORE_FRAME_EXCEPTION(frame_f029144a77569ea4f7abe525343ad19c); 239     RESTORE_FRAME_EXCEPTION(frame_f029144a77569ea4f7abe525343ad19c);