Construct InplaceOperationFloatAdd

Performance Diagrams

Construct InplaceOperationFloatAdd 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1848381188.95192307692307257.0CPython 2.76250109242.31730769230768420.555880061747Nuitka (master)6300300395.6826923076923419.88486214941116Nuitka (develop)6299814549.0480769230769419.8913596231693Nuitka (factory)Construct InplaceOperationFloatAddTicks Construct InplaceOperationFloatAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1707046788.95192307692307257.0CPython 3.56200517242.31730769230768414.3555002918198Nuitka (master)6187351395.6826923076923414.54609385635706Nuitka (develop)6212706549.0480769230769414.1790499684Nuitka (factory)Construct InplaceOperationFloatAddTicks

Source Code with Construct

module_value1 = 5.0
module_value2 = 3.0

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

    # Make sure we have a local variable s anyway
    s = 2.0

    local_value = module_value1

    s += module_value1
# construct_begin
    s += 1000.0
# 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.0
module_value2 = 3.0

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

    # Make sure we have a local variable s anyway
    s = 2.0

    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.0 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
44 static PyObject *const_str_plain_module_value2; 44 static PyObject *const_str_plain_module_value2;
45 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 45 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
46 static PyObject *const_str_plain_module_value1; 46 static PyObject *const_str_plain_module_value1;
47 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 47 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
48 static PyObject *const_str_plain_calledRepeatedly; 48 static PyObject *const_str_plain_calledRepeatedly;
n 49 static PyObject *const_float_1000_0; n
50 static PyObject *const_str_angle_module; 49 static PyObject *const_str_angle_module;
51 static PyObject *const_str_plain_None; 50 static PyObject *const_str_plain_None;
52 static PyObject *const_str_plain_x; 51 static PyObject *const_str_plain_x;
53 extern PyObject *const_tuple_empty; 52 extern PyObject *const_tuple_empty;
54 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 53 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
78     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 134 ], 13, 1 ); 77     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 134 ], 13, 1 );
79     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 78     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 ); 79     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 ); 80     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[ 147 ], 16, 1 ); 81     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 147 ], 16, 1 );
n 83     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 163 ] ); n
84     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 171 ], 8, 0 ); 82     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 163 ], 8, 0 );
85     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 179 ], 4, 1 ); 83     const_str_plain_None = UNSTREAM_STRING( &constant_bin[ 171 ], 4, 1 );
86     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 34 ], 1, 1 ); 84     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 34 ], 1, 1 );
n 87     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 183 ], 6, 1 ); n 85     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 175 ], 6, 1 );
88     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 86     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
89     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 87     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
90     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 88     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 91     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 189 ] ); n 89     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 181 ] );
92 90
93     constants_created = true; 91     constants_created = true;
94 } 92 }
95 93
96 #ifndef __NUITKA_NO_ASSERT__ 94 #ifndef __NUITKA_NO_ASSERT__
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_float_1000_0; 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_d321c0df96478aac171c307af281ae63 ); 304     RESTORE_FRAME_EXCEPTION( frame_d321c0df96478aac171c307af281ae63 );