Construct InplaceOperationIntegerAdd

Performance Diagrams

Construct InplaceOperationIntegerAdd 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1243301088.95192307692307257.0CPython 2.75999897242.31730769230768384.86293852166375Nuitka (master)6000191395.6826923076923384.85709505149225Nuitka (develop)5999963549.0480769230769384.8616267222375Nuitka (factory)Construct InplaceOperationIntegerAddTicks Construct InplaceOperationIntegerAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2276948788.95192307692307257.0CPython 3.517700026242.31730769230768312.0184466082917Nuitka (master)17699610395.6826923076923312.0229614223497Nuitka (develop)17700080549.0480769230769312.01786055069766Nuitka (factory)Construct InplaceOperationIntegerAddTicks

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
43 static PyObject *const_int_pos_3; 43 static PyObject *const_int_pos_3;
44 static PyObject *const_str_plain_local_value; 44 static PyObject *const_str_plain_local_value;
45 static PyObject *const_int_pos_50000; 45 static PyObject *const_int_pos_50000;
46 static PyObject *const_str_plain_module_value2; 46 static PyObject *const_str_plain_module_value2;
47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
n 48 static PyObject *const_int_pos_1000; n
49 static PyObject *const_str_plain_module_value1; 48 static PyObject *const_str_plain_module_value1;
50 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 49 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
51 static PyObject *const_str_plain_calledRepeatedly; 50 static PyObject *const_str_plain_calledRepeatedly;
52 static PyObject *const_str_angle_module; 51 static PyObject *const_str_angle_module;
53 static PyObject *const_str_plain_x; 52 static PyObject *const_str_plain_x;
77     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 76     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
78     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 123 ], 13, 1 ); 77     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 123 ], 13, 1 );
79     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 78     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
80     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 136 ], 3, 0 ); 79     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 136 ], 3, 0 );
81     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 ); 80     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF( const_str_digest_5ed1392909ad16e6227b8230f4582352 );
n 82     const_int_pos_1000 = PyLong_FromUnsignedLong( 1000ul ); n
83     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 139 ], 13, 1 ); 81     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 139 ], 13, 1 );
84     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 82     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
85     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, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
86     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     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 );
87     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 152 ], 16, 1 ); 85     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 152 ], 16, 1 );
145     PyTracebackObject *exception_keeper_tb_1; 143     PyTracebackObject *exception_keeper_tb_1;
146     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 144     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
147     PyObject *tmp_assign_source_1; 145     PyObject *tmp_assign_source_1;
148     PyObject *tmp_assign_source_2; 146     PyObject *tmp_assign_source_2;
149     PyObject *tmp_assign_source_3; 147     PyObject *tmp_assign_source_3;
n 150     PyObject *tmp_assign_source_4; n
151     PyObject *tmp_left_name_1; 148     PyObject *tmp_left_name_1;
152     PyObject *tmp_left_name_2; 149     PyObject *tmp_left_name_2;
n 153     PyObject *tmp_left_name_3; n
154     bool tmp_result; 150     bool tmp_result;
155     PyObject *tmp_return_value; 151     PyObject *tmp_return_value;
156     PyObject *tmp_right_name_1; 152     PyObject *tmp_right_name_1;
157     PyObject *tmp_right_name_2; 153     PyObject *tmp_right_name_2;
n 158     PyObject *tmp_right_name_3; n
159     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 154     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
160     static struct Nuitka_FrameObject *cache_frame_7af43851d400c4ad3579a980e9ba7b0f = NULL; 155     static struct Nuitka_FrameObject *cache_frame_7af43851d400c4ad3579a980e9ba7b0f = NULL;
161 156
162     struct Nuitka_FrameObject *frame_7af43851d400c4ad3579a980e9ba7b0f; 157     struct Nuitka_FrameObject *frame_7af43851d400c4ad3579a980e9ba7b0f;
163 158
263     var_s = tmp_assign_source_2; 258     var_s = tmp_assign_source_2;
264 259
265     tmp_left_name_2 = var_s; 260     tmp_left_name_2 = var_s;
266 261
267     CHECK_OBJECT( tmp_left_name_2 ); 262     CHECK_OBJECT( tmp_left_name_2 );
n 268     tmp_right_name_2 = const_int_pos_1000; n
269     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
270     tmp_assign_source_3 = tmp_left_name_2;
271     if ( tmp_result == false )
272     {
273         assert( ERROR_OCCURRED() );
274  
275         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
276  
277  
278         exception_lineno = 35;
279         type_description_1 = "oo";
280         goto frame_exception_exit_1;
281     }
282     var_s = tmp_assign_source_3;
283  
284     tmp_left_name_3 = var_s;
285  
286     CHECK_OBJECT( tmp_left_name_3 );
287     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 263     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
288 264
n 289     if (unlikely( tmp_right_name_3 == NULL )) n 265     if (unlikely( tmp_right_name_2 == NULL ))
290     { 266     {
n 291         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 267         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
292     } 268     }
293 269
n 294     if ( tmp_right_name_3 == NULL ) n 270     if ( tmp_right_name_2 == NULL )
295     { 271     {
296 272
297         exception_type = PyExc_NameError; 273         exception_type = PyExc_NameError;
298         Py_INCREF( exception_type ); 274         Py_INCREF( exception_type );
299         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 275         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
304         exception_lineno = 37; 280         exception_lineno = 37;
305         type_description_1 = "oo"; 281         type_description_1 = "oo";
306         goto frame_exception_exit_1; 282         goto frame_exception_exit_1;
307     } 283     }
308 284
n 309     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 285     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
310     tmp_assign_source_4 = tmp_left_name_3; 286     tmp_assign_source_3 = tmp_left_name_2;
311     if ( tmp_result == false ) 287     if ( tmp_result == false )
312     { 288     {
313         assert( ERROR_OCCURRED() ); 289         assert( ERROR_OCCURRED() );
314 290
315         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 291         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
317 293
318         exception_lineno = 37; 294         exception_lineno = 37;
319         type_description_1 = "oo"; 295         type_description_1 = "oo";
320         goto frame_exception_exit_1; 296         goto frame_exception_exit_1;
321     } 297     }
t 322     var_s = tmp_assign_source_4; t 298     var_s = tmp_assign_source_3;
323 299
324 300
325 #if 0 301 #if 0
326     RESTORE_FRAME_EXCEPTION( frame_7af43851d400c4ad3579a980e9ba7b0f ); 302     RESTORE_FRAME_EXCEPTION( frame_7af43851d400c4ad3579a980e9ba7b0f );
327 #endif 303 #endif