Construct InplaceOperationFloatAdd

Performance Diagrams

Construct InplaceOperationFloatAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1612590473.61538461538461257.0CPython 2.712999931196.30769230769232304.9028040965832Nuitka (historic)5650229319.0000000000001417.5305635411677Nuitka (master)5650039441.69230769230774417.53347512510595Nuitka (develop)5650035564.3846153846155417.53353642160994Nuitka (factory)Construct InplaceOperationFloatAddTicks Construct InplaceOperationFloatAdd 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1202274373.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)2101424319.0000000000001460.92272882959594Nuitka (master)2088018441.69230769230774461.19827566995957Nuitka (develop)2087938564.3846153846155461.1999199894605Nuitka (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 static PyObject *const_float_3_0; 56 static PyObject *const_float_3_0;
79     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 137 ], 13, 1 ); 78     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 137 ], 13, 1 );
80     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 ); 79     const_tuple_str_plain_s_str_plain_local_value_tuple = PyTuple_New( 2 );
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 ); 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 );
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 ); 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 );
83     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 150 ], 16, 1 ); 82     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 150 ], 16, 1 );
n 84     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 166 ] ); n
85     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 174 ], 8, 0 ); 83     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 166 ], 8, 0 );
86     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 45 ], 1, 1 ); 84     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 45 ], 1, 1 );
n 87     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 182 ] ); n 85     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 174 ] );
88 86
89     constants_created = true; 87     constants_created = true;
90 } 88 }
91 89
92 #ifndef __NUITKA_NO_ASSERT__ 90 #ifndef __NUITKA_NO_ASSERT__
136     PyTracebackObject *exception_keeper_tb_1; 134     PyTracebackObject *exception_keeper_tb_1;
137     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 135     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
138     PyObject *tmp_assign_source_1; 136     PyObject *tmp_assign_source_1;
139     PyObject *tmp_assign_source_2; 137     PyObject *tmp_assign_source_2;
140     PyObject *tmp_assign_source_3; 138     PyObject *tmp_assign_source_3;
n 141     PyObject *tmp_assign_source_4; n
142     PyObject *tmp_left_name_1; 139     PyObject *tmp_left_name_1;
143     PyObject *tmp_left_name_2; 140     PyObject *tmp_left_name_2;
n 144     PyObject *tmp_left_name_3; n
145     bool tmp_result; 141     bool tmp_result;
146     PyObject *tmp_return_value; 142     PyObject *tmp_return_value;
147     PyObject *tmp_right_name_1; 143     PyObject *tmp_right_name_1;
148     PyObject *tmp_right_name_2; 144     PyObject *tmp_right_name_2;
n 149     PyObject *tmp_right_name_3; n
150     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 145     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
151     static struct Nuitka_FrameObject *cache_frame_a8531f60c13ae8c0994e80b6b0c277a3 = NULL; 146     static struct Nuitka_FrameObject *cache_frame_a8531f60c13ae8c0994e80b6b0c277a3 = NULL;
152 147
153     struct Nuitka_FrameObject *frame_a8531f60c13ae8c0994e80b6b0c277a3; 148     struct Nuitka_FrameObject *frame_a8531f60c13ae8c0994e80b6b0c277a3;
154 149
254     var_s = tmp_assign_source_2; 249     var_s = tmp_assign_source_2;
255 250
256     tmp_left_name_2 = var_s; 251     tmp_left_name_2 = var_s;
257 252
258     CHECK_OBJECT( tmp_left_name_2 ); 253     CHECK_OBJECT( tmp_left_name_2 );
n 259     tmp_right_name_2 = const_float_1000_0; n
260     tmp_result = BINARY_OPERATION_ADD_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
261     tmp_assign_source_3 = tmp_left_name_2;
262     if ( tmp_result == false )
263     {
264         assert( ERROR_OCCURRED() );
265  
266         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
267  
268  
269         exception_lineno = 35;
270         type_description = "oo";
271         goto frame_exception_exit_1;
272     }
273     var_s = tmp_assign_source_3;
274  
275     tmp_left_name_3 = var_s;
276  
277     CHECK_OBJECT( tmp_left_name_3 );
278     tmp_right_name_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 254     tmp_right_name_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
279 255
n 280     if (unlikely( tmp_right_name_3 == NULL )) n 256     if (unlikely( tmp_right_name_2 == NULL ))
281     { 257     {
n 282         tmp_right_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); n 258         tmp_right_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
283     } 259     }
284 260
n 285     if ( tmp_right_name_3 == NULL ) n 261     if ( tmp_right_name_2 == NULL )
286     { 262     {
287 263
288         exception_type = PyExc_NameError; 264         exception_type = PyExc_NameError;
289         Py_INCREF( exception_type ); 265         Py_INCREF( exception_type );
290         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 266         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
295         exception_lineno = 37; 271         exception_lineno = 37;
296         type_description = "oo"; 272         type_description = "oo";
297         goto frame_exception_exit_1; 273         goto frame_exception_exit_1;
298     } 274     }
299 275
n 300     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 );
301     tmp_assign_source_4 = tmp_left_name_3; 277     tmp_assign_source_3 = tmp_left_name_2;
302     if ( tmp_result == false ) 278     if ( tmp_result == false )
303     { 279     {
304         assert( ERROR_OCCURRED() ); 280         assert( ERROR_OCCURRED() );
305 281
306         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 282         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
308 284
309         exception_lineno = 37; 285         exception_lineno = 37;
310         type_description = "oo"; 286         type_description = "oo";
311         goto frame_exception_exit_1; 287         goto frame_exception_exit_1;
312     } 288     }
t 313     var_s = tmp_assign_source_4; t 289     var_s = tmp_assign_source_3;
314 290
315 291
316 #if 0 292 #if 0
317     RESTORE_FRAME_EXCEPTION( frame_a8531f60c13ae8c0994e80b6b0c277a3 ); 293     RESTORE_FRAME_EXCEPTION( frame_a8531f60c13ae8c0994e80b6b0c277a3 );
318 #endif 294 #endif