Construct InplaceOperationIntegerMul

Performance Diagrams

Construct InplaceOperationIntegerMul 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1518071688.95192307692307257.0CPython 2.710050014242.31730769230768340.51881413741773Nuitka (master)10050050395.6826923076923340.51822812066814Nuitka (develop)10049996549.0480769230769340.5191071457925Nuitka (factory)Construct InplaceOperationIntegerMulTicks Construct InplaceOperationIntegerMul 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2542035188.95192307692307257.0CPython 3.521400079242.31730769230768296.0817208439986Nuitka (master)21400018395.6826923076923296.0823138349633Nuitka (develop)21400401549.0480769230769296.07859062939826Nuitka (factory)Construct InplaceOperationIntegerMulTicks

Source Code with Construct

module_value1 = 5
module_value2 = 3

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable x anyway
    s = 2

    local_value = module_value1

    s *= module_value1
# construct_begin
    s *= 1000
# construct_end
    s *= module_value2

    return s

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

print("OK.")

Source Code without Construct

module_value1 = 5
module_value2 = 3

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    # Make sure we have a local variable x anyway
    s = 2

    local_value = module_value1

    s *= module_value1
# construct_begin


    s *= module_value2

    return s

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

print("OK.")

Context Diff of Source Code


Construct
Baseline
30 30
31     local_value = module_value1 31     local_value = module_value1
32 32
33     s *= module_value1 33     s *= module_value1
34 # construct_begin 34 # construct_begin
t 35     s *= 1000 t 35  
36 # construct_end 36  
37     s *= module_value2 37     s *= module_value2
38 38
39     return s 39     return s
40 40
41 import itertools 41 import itertools

Context Diff of Generated Code


Construct
Baseline
39 static PyObject *const_int_pos_3; 39 static PyObject *const_int_pos_3;
40 static PyObject *const_str_plain_local_value; 40 static PyObject *const_str_plain_local_value;
41 static PyObject *const_int_pos_50000; 41 static PyObject *const_int_pos_50000;
42 static PyObject *const_str_plain_module_value2; 42 static PyObject *const_str_plain_module_value2;
43 extern PyObject *const_str_plain___doc__; 43 extern PyObject *const_str_plain___doc__;
n 44 static PyObject *const_int_pos_1000; n
45 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 44 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
46 static PyObject *const_str_plain_module_value1; 45 static PyObject *const_str_plain_module_value1;
47 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 46 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
48 static PyObject *const_str_plain_calledRepeatedly; 47 static PyObject *const_str_plain_calledRepeatedly;
49 static PyObject *const_str_angle_module; 48 static PyObject *const_str_angle_module;
69     const_str_plain_s = UNSTREAM_STRING_ASCII(&constant_bin[ 22 ], 1, 1); 68     const_str_plain_s = UNSTREAM_STRING_ASCII(&constant_bin[ 22 ], 1, 1);
70     const_int_pos_3 = PyLong_FromUnsignedLong(3ul); 69     const_int_pos_3 = PyLong_FromUnsignedLong(3ul);
71     const_str_plain_local_value = UNSTREAM_STRING_ASCII(&constant_bin[ 117 ], 11, 1); 70     const_str_plain_local_value = UNSTREAM_STRING_ASCII(&constant_bin[ 117 ], 11, 1);
72     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul); 71     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
73     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII(&constant_bin[ 41 ], 13, 1); 72     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII(&constant_bin[ 41 ], 13, 1);
n 74     const_int_pos_1000 = PyLong_FromUnsignedLong(1000ul); n
75     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1); 73     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1);
76     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 128 ], 3, 0); 74     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 128 ], 3, 0);
77     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352); 75     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352);
78     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 13, 1); 76     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 13, 1);
79     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New(2); 77     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New(2);
252     } 250     }
253     { 251     {
254         PyObject *tmp_assign_source_3; 252         PyObject *tmp_assign_source_3;
255         PyObject *tmp_left_name_2; 253         PyObject *tmp_left_name_2;
256         PyObject *tmp_right_name_2; 254         PyObject *tmp_right_name_2;
n n 255         PyObject *tmp_mvar_value_4;
257         CHECK_OBJECT(var_s); 256         CHECK_OBJECT(var_s);
258         tmp_left_name_2 = var_s; 257         tmp_left_name_2 = var_s;
n 259         tmp_right_name_2 = const_int_pos_1000; n
260         tmp_result = BINARY_OPERATION_MUL_INPLACE(&tmp_left_name_2, tmp_right_name_2);
261         if (tmp_result == false) {
262             assert(ERROR_OCCURRED());
263  
264             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
265  
266  
267             exception_lineno = 35;
268             type_description_1 = "oo";
269             goto frame_exception_exit_1;
270         }
271         tmp_assign_source_3 = tmp_left_name_2;
272         var_s = tmp_assign_source_3;
273  
274     }
275     {
276         PyObject *tmp_assign_source_4;
277         PyObject *tmp_left_name_3;
278         PyObject *tmp_right_name_3;
279         PyObject *tmp_mvar_value_4;
280         CHECK_OBJECT(var_s);
281         tmp_left_name_3 = var_s;
282         tmp_mvar_value_4 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2); 258         tmp_mvar_value_4 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2);
283 259
284         if (unlikely(tmp_mvar_value_4 == NULL)) { 260         if (unlikely(tmp_mvar_value_4 == NULL)) {
285             tmp_mvar_value_4 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2); 261             tmp_mvar_value_4 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2);
286         } 262         }
297             exception_lineno = 37; 273             exception_lineno = 37;
298             type_description_1 = "oo"; 274             type_description_1 = "oo";
299             goto frame_exception_exit_1; 275             goto frame_exception_exit_1;
300         } 276         }
301 277
n 302         tmp_right_name_3 = tmp_mvar_value_4; n 278         tmp_right_name_2 = tmp_mvar_value_4;
303         tmp_result = BINARY_OPERATION_MUL_INPLACE(&tmp_left_name_3, tmp_right_name_3); 279         tmp_result = BINARY_OPERATION_MUL_INPLACE(&tmp_left_name_2, tmp_right_name_2);
304         if (tmp_result == false) { 280         if (tmp_result == false) {
305             assert(ERROR_OCCURRED()); 281             assert(ERROR_OCCURRED());
306 282
307             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 283             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
308 284
309 285
310             exception_lineno = 37; 286             exception_lineno = 37;
311             type_description_1 = "oo"; 287             type_description_1 = "oo";
312             goto frame_exception_exit_1; 288             goto frame_exception_exit_1;
313         } 289         }
t 314         tmp_assign_source_4 = tmp_left_name_3; t 290         tmp_assign_source_3 = tmp_left_name_2;
315         var_s = tmp_assign_source_4; 291         var_s = tmp_assign_source_3;
316 292
317     } 293     }
318 294
319 #if 0 295 #if 0
320     RESTORE_FRAME_EXCEPTION(frame_71fd64dc20448f406502bf682c59b5ab); 296     RESTORE_FRAME_EXCEPTION(frame_71fd64dc20448f406502bf682c59b5ab);