Construct InplaceOperationIntegerMul

Performance Diagrams

Construct InplaceOperationIntegerMul 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1568408088.95192307692307257.0CPython 2.78500100242.31730769230768370.1894239744525Nuitka (master)8500106395.6826923076923370.1893294395925Nuitka (develop)8500058549.0480769230769370.1900857184728Nuitka (factory)Construct InplaceOperationIntegerMulTicks Construct InplaceOperationIntegerMul 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2491970588.95192307692307257.0CPython 3.518699859242.31730769230768318.6788857066511Nuitka (master)18700329395.6826923076923318.6742249680601Nuitka (develop)18700385549.0480769230769318.67366964601524Nuitka (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
40 static PyObject *const_int_pos_3; 40 static PyObject *const_int_pos_3;
41 static PyObject *const_str_plain_local_value; 41 static PyObject *const_str_plain_local_value;
42 static PyObject *const_int_pos_50000; 42 static PyObject *const_int_pos_50000;
43 static PyObject *const_str_plain_module_value2; 43 static PyObject *const_str_plain_module_value2;
44 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 44 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
n 45 static PyObject *const_int_pos_1000; n
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;
50 static PyObject *const_str_plain_None; 49 static PyObject *const_str_plain_None;
74     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 73     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
75     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII( &constant_bin[ 97 ], 13, 1 ); 74     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII( &constant_bin[ 97 ], 13, 1 );
76     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 75     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
77     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 110 ], 3, 0 ); 76     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 110 ], 3, 0 );
78     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 77     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 79     const_int_pos_1000 = PyLong_FromUnsignedLong( 1000ul ); n
80     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 113 ], 13, 1 ); 78     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII( &constant_bin[ 113 ], 13, 1 );
81     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 79     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
82     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s ); 80     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
83     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 1, const_str_plain_local_value ); Py_INCREF( const_str_plain_local_value ); 81     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 1, const_str_plain_local_value ); Py_INCREF( const_str_plain_local_value );
84     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 126 ], 16, 1 ); 82     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 126 ], 16, 1 );
261     } 259     }
262     { 260     {
263         PyObject *tmp_assign_source_3; 261         PyObject *tmp_assign_source_3;
264         PyObject *tmp_left_name_2; 262         PyObject *tmp_left_name_2;
265         PyObject *tmp_right_name_2; 263         PyObject *tmp_right_name_2;
n n 264         PyObject *tmp_mvar_value_4;
266         CHECK_OBJECT( var_s ); 265         CHECK_OBJECT( var_s );
267         tmp_left_name_2 = var_s; 266         tmp_left_name_2 = var_s;
n 268         tmp_right_name_2 = const_int_pos_1000; n
269         tmp_result = BINARY_OPERATION_MUL_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
270         if ( tmp_result == false )
271         {
272             assert( ERROR_OCCURRED() );
273  
274             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
275  
276  
277             exception_lineno = 35;
278             type_description_1 = "oo";
279             goto frame_exception_exit_1;
280         }
281         tmp_assign_source_3 = tmp_left_name_2;
282         var_s = tmp_assign_source_3;
283  
284     }
285     {
286         PyObject *tmp_assign_source_4;
287         PyObject *tmp_left_name_3;
288         PyObject *tmp_right_name_3;
289         PyObject *tmp_mvar_value_4;
290         CHECK_OBJECT( var_s );
291         tmp_left_name_3 = var_s;
292         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 267         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
293 268
294         if (unlikely( tmp_mvar_value_4 == NULL )) 269         if (unlikely( tmp_mvar_value_4 == NULL ))
295         { 270         {
296             tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); 271             tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
309             exception_lineno = 37; 284             exception_lineno = 37;
310             type_description_1 = "oo"; 285             type_description_1 = "oo";
311             goto frame_exception_exit_1; 286             goto frame_exception_exit_1;
312         } 287         }
313 288
n 314         tmp_right_name_3 = tmp_mvar_value_4; n 289         tmp_right_name_2 = tmp_mvar_value_4;
315         tmp_result = BINARY_OPERATION_MUL_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); 290         tmp_result = BINARY_OPERATION_MUL_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
316         if ( tmp_result == false ) 291         if ( tmp_result == false )
317         { 292         {
318             assert( ERROR_OCCURRED() ); 293             assert( ERROR_OCCURRED() );
319 294
320             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 295             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
322 297
323             exception_lineno = 37; 298             exception_lineno = 37;
324             type_description_1 = "oo"; 299             type_description_1 = "oo";
325             goto frame_exception_exit_1; 300             goto frame_exception_exit_1;
326         } 301         }
t 327         tmp_assign_source_4 = tmp_left_name_3; t 302         tmp_assign_source_3 = tmp_left_name_2;
328         var_s = tmp_assign_source_4; 303         var_s = tmp_assign_source_3;
329 304
330     } 305     }
331 306
332 #if 0 307 #if 0
333     RESTORE_FRAME_EXCEPTION( frame_d8453583379609ae1cd72b8f8dfa105e ); 308     RESTORE_FRAME_EXCEPTION( frame_d8453583379609ae1cd72b8f8dfa105e );