Construct InplaceOperationFloatAdd

Performance Diagrams

Construct InplaceOperationFloatAdd 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1833479988.95192307692307257.00000000000006CPython 2.75300023242.31730769230768432.68197418555746Nuitka (master)5300011395.6826923076923432.6821359208792Nuitka (develop)5300125549.0480769230769432.6805994353226Nuitka (factory)Construct InplaceOperationFloatAddTicks Construct InplaceOperationFloatAdd 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)1717051188.95192307692307257.0CPython 3.55290725242.31730769230768427.97207453747075Nuitka (master)5289959395.6826923076923427.98309869304865Nuitka (develop)5289945549.0480769230769427.9833001789208Nuitka (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_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 44 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
45 static PyObject *const_str_plain_module_value1; 45 static PyObject *const_str_plain_module_value1;
46 static PyObject *const_str_digest_160d54e26f9e9e16f1b54ec69f99af49; 46 static PyObject *const_str_digest_160d54e26f9e9e16f1b54ec69f99af49;
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;
80     const_str_digest_160d54e26f9e9e16f1b54ec69f99af49 = UNSTREAM_STRING_ASCII( &constant_bin[ 65 ], 75, 0 ); 79     const_str_digest_160d54e26f9e9e16f1b54ec69f99af49 = UNSTREAM_STRING_ASCII( &constant_bin[ 65 ], 75, 0 );
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_ASCII( &constant_bin[ 140 ], 16, 1 ); 83     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 140 ], 16, 1 );
n 85     const_float_1000_0 = UNSTREAM_FLOAT( &constant_bin[ 156 ] ); n
86     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 164 ], 8, 0 ); 84     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 156 ], 8, 0 );
87     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 172 ], 4, 1 ); 85     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 164 ], 4, 1 );
88     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 90 ], 1, 1 ); 86     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 90 ], 1, 1 );
n 89     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 176 ], 6, 1 ); n 87     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 168 ], 6, 1 );
90     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 88     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
91     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None ); 89     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF( Py_None );
92     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 ); 90     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF( const_int_pos_50000 );
n 93     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 182 ] ); n 91     const_float_3_0 = UNSTREAM_FLOAT( &constant_bin[ 174 ] );
94 92
95     constants_created = true; 93     constants_created = true;
96 } 94 }
97 95
98 /* Function to verify module private constants for non-corruption. */ 96 /* Function to verify module private constants for non-corruption. */
262     } 260     }
263     { 261     {
264         PyObject *tmp_assign_source_3; 262         PyObject *tmp_assign_source_3;
265         PyObject *tmp_left_name_2; 263         PyObject *tmp_left_name_2;
266         PyObject *tmp_right_name_2; 264         PyObject *tmp_right_name_2;
n n 265         PyObject *tmp_mvar_value_4;
267         CHECK_OBJECT( var_s ); 266         CHECK_OBJECT( var_s );
268         tmp_left_name_2 = var_s; 267         tmp_left_name_2 = var_s;
n 269         tmp_right_name_2 = const_float_1000_0; n
270         tmp_result = BINARY_OPERATION_ADD_OBJECT_FLOAT_INPLACE( &tmp_left_name_2, tmp_right_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         tmp_assign_source_3 = tmp_left_name_2;
283         var_s = tmp_assign_source_3;
284  
285     }
286     {
287         PyObject *tmp_assign_source_4;
288         PyObject *tmp_left_name_3;
289         PyObject *tmp_right_name_3;
290         PyObject *tmp_mvar_value_4;
291         CHECK_OBJECT( var_s );
292         tmp_left_name_3 = var_s;
293         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 ); 268         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value2 );
294 269
295         if (unlikely( tmp_mvar_value_4 == NULL )) 270         if (unlikely( tmp_mvar_value_4 == NULL ))
296         { 271         {
297             tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 ); 272             tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value2 );
310             exception_lineno = 37; 285             exception_lineno = 37;
311             type_description_1 = "oo"; 286             type_description_1 = "oo";
312             goto frame_exception_exit_1; 287             goto frame_exception_exit_1;
313         } 288         }
314 289
n 315         tmp_right_name_3 = tmp_mvar_value_4; n 290         tmp_right_name_2 = tmp_mvar_value_4;
316         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_3, tmp_right_name_3 ); 291         tmp_result = BINARY_OPERATION_ADD_OBJECT_OBJECT_INPLACE( &tmp_left_name_2, tmp_right_name_2 );
317         if ( tmp_result == false ) 292         if ( tmp_result == false )
318         { 293         {
319             assert( ERROR_OCCURRED() ); 294             assert( ERROR_OCCURRED() );
320 295
321             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 296             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
323 298
324             exception_lineno = 37; 299             exception_lineno = 37;
325             type_description_1 = "oo"; 300             type_description_1 = "oo";
326             goto frame_exception_exit_1; 301             goto frame_exception_exit_1;
327         } 302         }
t 328         tmp_assign_source_4 = tmp_left_name_3; t 303         tmp_assign_source_3 = tmp_left_name_2;
329         var_s = tmp_assign_source_4; 304         var_s = tmp_assign_source_3;
330 305
331     } 306     }
332 307
333 #if 0 308 #if 0
334     RESTORE_FRAME_EXCEPTION( frame_f04a966dd5cc1ac2abb5b6dcfbd6bcb1 ); 309     RESTORE_FRAME_EXCEPTION( frame_f04a966dd5cc1ac2abb5b6dcfbd6bcb1 );