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)5800824441.69230769230774415.22282678754726Nuitka (develop)5649387564.3846153846155417.5434664552521Nuitka (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)2204337441.69230769230774458.80745566964214Nuitka (develop)2100836564.3846153846155460.93481457792757Nuitka (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
46 static PyObject *const_str_plain_module_value2; 46 static PyObject *const_str_plain_module_value2;
47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 47 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
48 static PyObject *const_str_plain_module_value1; 48 static PyObject *const_str_plain_module_value1;
49 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple; 49 static PyObject *const_tuple_str_plain_s_str_plain_local_value_tuple;
50 static PyObject *const_str_plain_calledRepeatedly; 50 static PyObject *const_str_plain_calledRepeatedly;
n 51 static PyObject *const_float_1000_0; n
52 static PyObject *const_str_angle_module; 51 static PyObject *const_str_angle_module;
53 static PyObject *const_str_plain_x; 52 static PyObject *const_str_plain_x;
54 extern PyObject *const_tuple_empty; 53 extern PyObject *const_tuple_empty;
55 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 54 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
56 extern PyObject *const_str_plain___loader__; 55 extern PyObject *const_str_plain___loader__;
79     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 55 ], 13, 1 ); 78     const_str_plain_module_value1 = UNSTREAM_STRING( &constant_bin[ 55 ], 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[ 68 ], 16, 1 ); 82     const_str_plain_calledRepeatedly = UNSTREAM_STRING( &constant_bin[ 68 ], 16, 1 );
n 84     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 84 ] ); n
85     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 92 ], 8, 0 ); 83     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 84 ], 8, 0 );
86     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 100 ], 1, 1 ); 84     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 92 ], 1, 1 );
87     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 101 ] ); 85     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 93 ] );
88     const_str_digest_c6d2a1afec7a677b8b0c3886300dd482 = UNSTREAM_STRING( &constant_bin[ 109 ], 82, 0 ); 86     const_str_digest_c6d2a1afec7a677b8b0c3886300dd482 = UNSTREAM_STRING( &constant_bin[ 101 ], 82, 0 );
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_left_name_1; 140     PyObject *tmp_left_name_1;
144     PyObject *tmp_left_name_2; 141     PyObject *tmp_left_name_2;
n 145     PyObject *tmp_left_name_3; n
146     bool tmp_result; 142     bool tmp_result;
147     PyObject *tmp_return_value; 143     PyObject *tmp_return_value;
148     PyObject *tmp_right_name_1; 144     PyObject *tmp_right_name_1;
149     PyObject *tmp_right_name_2; 145     PyObject *tmp_right_name_2;
n 150     PyObject *tmp_right_name_3; n
151     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 146     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
152     static struct Nuitka_FrameObject *cache_frame_function = NULL; 147     static struct Nuitka_FrameObject *cache_frame_function = NULL;
153 148
154     struct Nuitka_FrameObject *frame_function; 149     struct Nuitka_FrameObject *frame_function;
155 150
254     assert( var_s == NULL ); 249     assert( var_s == NULL );
255     var_s = tmp_assign_source_2; 250     var_s = tmp_assign_source_2;
256 251
257     tmp_left_name_2 = var_s; 252     tmp_left_name_2 = var_s;
258 253
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     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 );
278 255
n 279     if (unlikely( tmp_right_name_3 == NULL )) n 256     if (unlikely( tmp_right_name_2 == NULL ))
280     { 257     {
n 281         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 );
282     } 259     }
283 260
n 284     if ( tmp_right_name_3 == NULL ) n 261     if ( tmp_right_name_2 == NULL )
285     { 262     {
286 263
287         exception_type = PyExc_NameError; 264         exception_type = PyExc_NameError;
288         Py_INCREF( exception_type ); 265         Py_INCREF( exception_type );
289         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" ); 266         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value2" );
294         exception_lineno = 37; 271         exception_lineno = 37;
295         type_description = "oo"; 272         type_description = "oo";
296         goto frame_exception_exit_1; 273         goto frame_exception_exit_1;
297     } 274     }
298 275
n 299     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 );
300     tmp_assign_source_4 = tmp_left_name_3; 277     tmp_assign_source_3 = tmp_left_name_2;
301     if ( tmp_result == false ) 278     if ( tmp_result == false )
302     { 279     {
303         assert( ERROR_OCCURRED() ); 280         assert( ERROR_OCCURRED() );
304 281
305         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 282         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
307 284
308         exception_lineno = 37; 285         exception_lineno = 37;
309         type_description = "oo"; 286         type_description = "oo";
310         goto frame_exception_exit_1; 287         goto frame_exception_exit_1;
311     } 288     }
t 312     var_s = tmp_assign_source_4; t 289     var_s = tmp_assign_source_3;
313 290
314 291
315 #if 0 292 #if 0
316     RESTORE_FRAME_EXCEPTION( frame_function ); 293     RESTORE_FRAME_EXCEPTION( frame_function );
317 #endif 294 #endif