Construct InplaceOperationIntegerAdd

Performance Diagrams

Construct InplaceOperationIntegerAdd 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1238290688.95192307692307257.0CPython 2.76000549242.31730769230768384.36740509923055Nuitka (master)6100539395.6826923076923382.3719876012949Nuitka (develop)6100053549.0480769230769382.38168630020476Nuitka (factory)Construct InplaceOperationIntegerAddTicks Construct InplaceOperationIntegerAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2277187188.95192307692307257.0CPython 3.517699786242.31730769230768312.0411617726503Nuitka (master)17751192395.6826923076923311.48331505634235Nuitka (develop)17746144549.0480769230769311.53809485294045Nuitka (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
40 static PyObject *const_str_plain_local_value; 40 static PyObject *const_str_plain_local_value;
41 static PyObject *const_str_digest_8f0bea797f84b74bd5a573be903701bf; 41 static PyObject *const_str_digest_8f0bea797f84b74bd5a573be903701bf;
42 static PyObject *const_str_plain_module_value2; 42 static PyObject *const_str_plain_module_value2;
43 static PyObject *const_int_pos_50000; 43 static PyObject *const_int_pos_50000;
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;
72     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 104 ], 13, 1 ); 71     const_str_plain_module_value2 = UNSTREAM_STRING( &constant_bin[ 104 ], 13, 1 );
73     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul ); 72     const_int_pos_50000 = PyLong_FromUnsignedLong( 50000ul );
74     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 73     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
75     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 117 ], 3, 0 ); 74     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING( &constant_bin[ 117 ], 3, 0 );
76     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 );
n 77     const_int_pos_1000 = PyLong_FromUnsignedLong( 1000ul ); n
78     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 120 ], 13, 1 ); 76     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 120 ], 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 );
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 ); 78     PyTuple_SET_ITEM( const_tuple_str_plain_s_str_plain_local_value_tuple, 0, const_str_plain_s ); Py_INCREF( const_str_plain_s );
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 ); 79     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 );
82     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 133 ], 16, 1 ); 80     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 133 ], 16, 1 );
261     PyObject *tmp_left_name_2; 259     PyObject *tmp_left_name_2;
262     PyObject *tmp_right_name_2; 260     PyObject *tmp_right_name_2;
263     tmp_left_name_2 = var_s; 261     tmp_left_name_2 = var_s;
264 262
265     CHECK_OBJECT( tmp_left_name_2 ); 263     CHECK_OBJECT( tmp_left_name_2 );
n 266     tmp_right_name_2 = const_int_pos_1000; n
267     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
268     tmp_assign_source_3 = tmp_left_name_2;
269     if ( tmp_result == false )
270     {
271         assert( ERROR_OCCURRED() );
272  
273         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
274  
275  
276         exception_lineno = 35;
277         type_description_1 = "oo";
278         goto frame_exception_exit_1;
279     }
280     var_s = tmp_assign_source_3;
281  
282     }
283     {
284     PyObject *tmp_assign_source_4;
285     PyObject *tmp_left_name_3;
286     PyObject *tmp_right_name_3;
287     tmp_left_name_3 = var_s;
288  
289     CHECK_OBJECT( tmp_left_name_3 );
290     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 264     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
291 265
n 292     if (unlikely( tmp_right_name_3 == NULL )) n 266     if (unlikely( tmp_right_name_2 == NULL ))
293     { 267     {
n 294         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 268         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
295     } 269     }
296 270
n 297     if ( tmp_right_name_3 == NULL ) n 271     if ( tmp_right_name_2 == NULL )
298     { 272     {
299 273
300         exception_type = PyExc_NameError; 274         exception_type = PyExc_NameError;
301         Py_INCREF( exception_type ); 275         Py_INCREF( exception_type );
302         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 276         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
307         exception_lineno = 37; 281         exception_lineno = 37;
308         type_description_1 = "oo"; 282         type_description_1 = "oo";
309         goto frame_exception_exit_1; 283         goto frame_exception_exit_1;
310     } 284     }
311 285
n 312     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 286     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
313     tmp_assign_source_4 = tmp_left_name_3; 287     tmp_assign_source_3 = tmp_left_name_2;
314     if ( tmp_result == false ) 288     if ( tmp_result == false )
315     { 289     {
316         assert( ERROR_OCCURRED() ); 290         assert( ERROR_OCCURRED() );
317 291
318         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 292         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
320 294
321         exception_lineno = 37; 295         exception_lineno = 37;
322         type_description_1 = "oo"; 296         type_description_1 = "oo";
323         goto frame_exception_exit_1; 297         goto frame_exception_exit_1;
324     } 298     }
t 325     var_s = tmp_assign_source_4; t 299     var_s = tmp_assign_source_3;
326 300
327     } 301     }
328 302
329 #if 0 303 #if 0
330     RESTORE_FRAME_EXCEPTION( frame_1525ee409d4064becb1753d01fa76c62 ); 304     RESTORE_FRAME_EXCEPTION( frame_1525ee409d4064becb1753d01fa76c62 );