Construct InplaceOperationStringAdd

Performance Diagrams

Construct InplaceOperationStringAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)4401000288.95192307692307257.0CPython 2.730985490242.31730769230768330.1324050452825Nuitka (master)30985513395.6826923076923330.13227590068834Nuitka (develop)30985513549.0480769230769330.13227590068834Nuitka (factory)Construct InplaceOperationStringAddTicks Construct InplaceOperationStringAdd 001000000010000000200000002000000030000000300000004000000040000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)4871085288.95192307692307257.0CPython 3.840170011242.31730769230768300.32860383254734Nuitka (master)40170011395.6826923076923300.32860383254734Nuitka (develop)40170011549.0480769230769300.32860383254734Nuitka (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
231             assert(ERROR_OCCURRED()); 231             assert(ERROR_OCCURRED());
232 232
233             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 233             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
234 234
235 235
n 236             exception_lineno = 37; n
237             type_description_1 = "oo";
238             goto frame_exception_exit_1;
239         }
240         tmp_assign_source_4 = tmp_left_name_2;
241         var_s = tmp_assign_source_4;
242  
243     }
244     {
245         PyObject *tmp_assign_source_5;
246         PyObject *tmp_left_name_3;
247         PyObject *tmp_right_name_3;
248         CHECK_OBJECT(var_s);
249         tmp_left_name_3 = var_s;
250         CHECK_OBJECT(var_additiv);
251         tmp_right_name_3 = var_additiv;
252         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_3, tmp_right_name_3);
253         if (tmp_result == false) {
254             assert(ERROR_OCCURRED());
255  
256             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
257  
258  
259             exception_lineno = 38;
260             type_description_1 = "oo";
261             goto frame_exception_exit_1;
262         }
263         tmp_assign_source_5 = tmp_left_name_3;
264         var_s = tmp_assign_source_5;
265  
266     }
267     {
268         PyObject *tmp_assign_source_6;
269         PyObject *tmp_left_name_4;
270         PyObject *tmp_right_name_4;
271         CHECK_OBJECT(var_s);
272         tmp_left_name_4 = var_s;
273         CHECK_OBJECT(var_additiv);
274         tmp_right_name_4 = var_additiv;
275         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_4, tmp_right_name_4);
276         if (tmp_result == false) {
277             assert(ERROR_OCCURRED());
278  
279             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
280  
281  
282             exception_lineno = 39;
283             type_description_1 = "oo";
284             goto frame_exception_exit_1;
285         }
286         tmp_assign_source_6 = tmp_left_name_4;
287         var_s = tmp_assign_source_6;
288  
289     }
290     {
291         PyObject *tmp_assign_source_7;
292         PyObject *tmp_left_name_5;
293         PyObject *tmp_right_name_5;
294         CHECK_OBJECT(var_s);
295         tmp_left_name_5 = var_s;
296         CHECK_OBJECT(var_additiv);
297         tmp_right_name_5 = var_additiv;
298         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_5, tmp_right_name_5);
299         if (tmp_result == false) {
300             assert(ERROR_OCCURRED());
301  
302             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
303  
304  
305             exception_lineno = 40;
306             type_description_1 = "oo";
307             goto frame_exception_exit_1;
308         }
309         tmp_assign_source_7 = tmp_left_name_5;
310         var_s = tmp_assign_source_7;
311  
312     }
313     {
314         PyObject *tmp_assign_source_8;
315         PyObject *tmp_left_name_6;
316         PyObject *tmp_right_name_6;
317         CHECK_OBJECT(var_s);
318         tmp_left_name_6 = var_s;
319         CHECK_OBJECT(var_additiv);
320         tmp_right_name_6 = var_additiv;
321         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_6, tmp_right_name_6);
322         if (tmp_result == false) {
323             assert(ERROR_OCCURRED());
324  
325             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
326  
327  
328             exception_lineno = 41;
329             type_description_1 = "oo";
330             goto frame_exception_exit_1;
331         }
332         tmp_assign_source_8 = tmp_left_name_6;
333         var_s = tmp_assign_source_8;
334  
335     }
336     {
337         PyObject *tmp_assign_source_9;
338         PyObject *tmp_left_name_7;
339         PyObject *tmp_right_name_7;
340         CHECK_OBJECT(var_s);
341         tmp_left_name_7 = var_s;
342         CHECK_OBJECT(var_additiv);
343         tmp_right_name_7 = var_additiv;
344         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE(&tmp_left_name_7, tmp_right_name_7);
345         if (tmp_result == false) {
346             assert(ERROR_OCCURRED());
347  
348             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
349  
350  
351             exception_lineno = 45; 236             exception_lineno = 45;
352             type_description_1 = "oo"; 237             type_description_1 = "oo";
353             goto frame_exception_exit_1; 238             goto frame_exception_exit_1;
354         } 239         }
t 355         tmp_assign_source_9 = tmp_left_name_7; t 240         tmp_assign_source_4 = tmp_left_name_2;
356         var_s = tmp_assign_source_9; 241         var_s = tmp_assign_source_4;
357 242
358     } 243     }
359 244
360 #if 0 245 #if 0
361     RESTORE_FRAME_EXCEPTION(frame_f4d9387dc56b80577027cb054f90f9e7); 246     RESTORE_FRAME_EXCEPTION(frame_f4d9387dc56b80577027cb054f90f9e7);