Construct InplaceOperationFloatAdd

Performance Diagrams

Construct InplaceOperationFloatAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1612590473.61538461538461257.0CPython 2.712999931196.30769230769232304.9028040965832Nuitka (historic)5800071319.0000000000001415.2343658544185Nuitka (master)5799845441.69230769230774415.2378291068925Nuitka (develop)5800365564.3846153846155415.22986056137717Nuitka (factory)Construct InplaceOperationFloatAddTicks Construct InplaceOperationFloatAdd 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1202274373.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)2198313319.0000000000001458.93127292806Nuitka (master)2195129441.69230769230774458.99671684419593Nuitka (develop)2196996564.3846153846155458.95834253784363Nuitka (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

for x in range(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

for x in range(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 for x in range(50000): 41 for x in range(50000):

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 extern PyObject *const_str_plain___loader__; 56 extern PyObject *const_str_plain___loader__;
80     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 136 ], 13, 1 ); 79     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 136 ], 13, 1 );
81     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 80     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 ); 81     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 ); 82     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( &constant_bin[ 149 ], 16, 1 ); 83     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 149 ], 16, 1 );
n 85     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 165 ] ); n
86     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 173 ], 8, 0 ); 84     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 165 ], 8, 0 );
87     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 25 ], 1, 1 ); 85     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 25 ], 1, 1 );
n 88     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 181 ] ); n 86     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 173 ] );
89 87
90     constants_created = true; 88     constants_created = true;
91 } 89 }
92 90
93 #ifndef __NUITKA_NO_ASSERT__ 91 #ifndef __NUITKA_NO_ASSERT__
137     PyTracebackObject *exception_keeper_tb_1; 135     PyTracebackObject *exception_keeper_tb_1;
138     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 136     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
139     PyObject *tmp_assign_source_1; 137     PyObject *tmp_assign_source_1;
140     PyObject *tmp_assign_source_2; 138     PyObject *tmp_assign_source_2;
141     PyObject *tmp_assign_source_3; 139     PyObject *tmp_assign_source_3;
n 142     PyObject *tmp_assign_source_4; n
143     PyObject *tmp_frame_locals; 140     PyObject *tmp_frame_locals;
144     PyObject *tmp_left_name_1; 141     PyObject *tmp_left_name_1;
145     PyObject *tmp_left_name_2; 142     PyObject *tmp_left_name_2;
n 146     PyObject *tmp_left_name_3; n
147     bool tmp_result; 143     bool tmp_result;
148     PyObject *tmp_return_value; 144     PyObject *tmp_return_value;
149     PyObject *tmp_right_name_1; 145     PyObject *tmp_right_name_1;
150     PyObject *tmp_right_name_2; 146     PyObject *tmp_right_name_2;
n 151     PyObject *tmp_right_name_3; n
152     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 147     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
153     static PyFrameObject *cache_frame_function = NULL; 148     static PyFrameObject *cache_frame_function = NULL;
154 149
155     PyFrameObject *frame_function; 150     PyFrameObject *frame_function;
156 151
255     assert( var_s == NULL ); 250     assert( var_s == NULL );
256     var_s = tmp_assign_source_2; 251     var_s = tmp_assign_source_2;
257 252
258     tmp_left_name_2 = var_s; 253     tmp_left_name_2 = var_s;
259 254
n 260     tmp_right_name_2 = const_float_1000_0; n
261     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
262     tmp_assign_source_3 = tmp_left_name_2;
263     if ( tmp_result == false )
264     {
265         assert( ERROR_OCCURRED() );
266  
267         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
268  
269  
270         exception_lineno = 35;
271         goto frame_exception_exit_1;
272     }
273     var_s = tmp_assign_source_3;
274  
275     tmp_left_name_3 = var_s;
276  
277     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 255     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
278 256
n 279     if (unlikely( tmp_right_name_3 == NULL )) n 257     if (unlikely( tmp_right_name_2 == NULL ))
280     { 258     {
n 281         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 259         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
282     } 260     }
283 261
n 284     if ( tmp_right_name_3 == NULL ) n 262     if ( tmp_right_name_2 == NULL )
285     { 263     {
286 264
287         exception_type = PyExc_NameError; 265         exception_type = PyExc_NameError;
288         Py_INCREF( exception_type ); 266         Py_INCREF( exception_type );
289         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 267         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
293 271
294         exception_lineno = 37; 272         exception_lineno = 37;
295         goto frame_exception_exit_1; 273         goto frame_exception_exit_1;
296     } 274     }
297 275
n 298     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); n 276     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
299     tmp_assign_source_4 = tmp_left_name_3; 277     tmp_assign_source_3 = tmp_left_name_2;
300     if ( tmp_result == false ) 278     if ( tmp_result == false )
301     { 279     {
302         assert( ERROR_OCCURRED() ); 280         assert( ERROR_OCCURRED() );
303 281
304         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 282         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
305 283
306 284
307         exception_lineno = 37; 285         exception_lineno = 37;
308         goto frame_exception_exit_1; 286         goto frame_exception_exit_1;
309     } 287     }
t 310     var_s = tmp_assign_source_4; t 288     var_s = tmp_assign_source_3;
311 289
312 290
313 #if 0 291 #if 0
314     RESTORE_FRAME_EXCEPTION( frame_function ); 292     RESTORE_FRAME_EXCEPTION( frame_function );
315 #endif 293 #endif