Construct InplaceOperationFloatAdd

Performance Diagrams

Construct InplaceOperationFloatAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1612638588.95192307692307257.0CPython 2.75650885242.31730769230768417.52309377076523Nuitka (master)5650051395.6826923076923417.5358737106444Nuitka (develop)5650122549.0480769230769417.5347857301511Nuitka (factory)Construct InplaceOperationFloatAddTicks Construct InplaceOperationFloatAdd 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1202275888.95192307692307257.0CPython 3.52092278242.31730769230768461.1107693106178Nuitka (master)2091112395.6826923076923461.1347352374427Nuitka (develop)2087310549.0480769230769461.2128814242251Nuitka (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
47 static PyObject *const_str_plain_module_value2; 47 static PyObject *const_str_plain_module_value2;
48 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 48 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
49 static PyObject *const_str_plain_module_value1; 49 static PyObject *const_str_plain_module_value1;
50 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 50 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
51 static PyObject *const_str_plain_calledRepeatedly; 51 static PyObject *const_str_plain_calledRepeatedly;
n 52 static PyObject *const_float_1000_0; n
53 static PyObject *const_str_angle_module; 52 static PyObject *const_str_angle_module;
54 static PyObject *const_str_plain_x; 53 static PyObject *const_str_plain_x;
55 extern PyObject *const_tuple_empty; 54 extern PyObject *const_tuple_empty;
56 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 55 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
57 static PyObject *const_str_plain_repeat; 56 static PyObject *const_str_plain_repeat;
83     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 153 ], 13, 1 ); 82     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 153 ], 13, 1 );
84     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 83     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 ); 84     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 ); 85     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[ 166 ], 16, 1 ); 86     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 166 ], 16, 1 );
n 88     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 182 ] ); n
89     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 190 ], 8, 0 ); 87     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 182 ], 8, 0 );
90     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 53 ], 1, 1 ); 88     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 53 ], 1, 1 );
n 91     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 198 ], 6, 1 ); n 89     const_str_plain_repeat = UNSTREAM_STRING( &constant_bin[ 190 ], 6, 1 );
92     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 90     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
93     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 91     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
94     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 92     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 95     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 204 ] ); n 93     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 196 ] );
96 94
97     constants_created = true; 95     constants_created = true;
98 } 96 }
99 97
100 #ifndef __NUITKA_NO_ASSERT__ 98 #ifndef __NUITKA_NO_ASSERT__
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_8c69477de269610f474313b1006ef665 = NULL; 155     static struct Nuitka_FrameObject *cache_frame_8c69477de269610f474313b1006ef665 = NULL;
161 156
162     struct Nuitka_FrameObject *frame_8c69477de269610f474313b1006ef665; 157     struct Nuitka_FrameObject *frame_8c69477de269610f474313b1006ef665;
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_float_1000_0; 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_8c69477de269610f474313b1006ef665 ); 302     RESTORE_FRAME_EXCEPTION( frame_8c69477de269610f474313b1006ef665 );
327 #endif 303 #endif