Construct LocalVariableAssign

Performance Diagrams

Construct LocalVariableAssign 002000020000400004000060000600008000080000100000100000120000120000140000140000160000160000180000180000200000200000220000220000240000240000260000260000280000280000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)20574975.0334.48130792790755CPython 2.7299726200.0257.0Nuitka (historic)99889325.0421.75980433924525Nuitka (master)49994450.0462.896783164521Nuitka (develop)50000575.0462.89183633872784Nuitka (factory)Construct LocalVariableAssignTicks Construct LocalVariableAssign 002000020000400004000060000600008000080000100000100000120000120000140000140000160000160000180000180000200000200000220000220000240000240000260000260000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)26040675.0257.0CPython 3.50200.0504.11538461538464Nuitka (historic)50066325.0456.6046558067019Nuitka (master)49069450.0457.55077086726703Nuitka (develop)49869575.0456.7916013101435Nuitka (factory)Construct LocalVariableAssignTicks

Source Code with Construct

module_value1 = 1000
module_value2 = 50

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1
    local_value2 = module_value2

# construct_begin
    local_value2 = local_value * 2
# construct_alternative



    local_value2 = local_value * 4

    return local_value

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

module_value1 = 1000
module_value2 = 50

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = module_value1
    local_value2 = module_value2

# construct_begin

# construct_alternative
    local_value * 2
# construct_end

    local_value2 = local_value * 4

    return local_value

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
26 26
27     local_value = module_value1 27     local_value = module_value1
28     local_value2 = module_value2 28     local_value2 = module_value2
29 29
30 # construct_begin 30 # construct_begin
n 31     local_value2 = local_value * 2 n 31  
32 # construct_alternative 32 # construct_alternative
t 33   t 33     local_value * 2
34   34 # construct_end
35 35
36     local_value2 = local_value * 4 36     local_value2 = local_value * 4
37 37
38     return local_value 38     return local_value
39 39

Context Diff of Generated Code


Construct
Baseline
136     PyTracebackObject *exception_keeper_tb_1; 136     PyTracebackObject *exception_keeper_tb_1;
137     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 137     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
138     PyObject *tmp_assign_source_1; 138     PyObject *tmp_assign_source_1;
139     PyObject *tmp_assign_source_2; 139     PyObject *tmp_assign_source_2;
140     PyObject *tmp_assign_source_3; 140     PyObject *tmp_assign_source_3;
n 141     PyObject *tmp_assign_source_4; n
142     PyObject *tmp_left_name_1; 141     PyObject *tmp_left_name_1;
143     PyObject *tmp_left_name_2; 142     PyObject *tmp_left_name_2;
144     PyObject *tmp_return_value; 143     PyObject *tmp_return_value;
145     PyObject *tmp_right_name_1; 144     PyObject *tmp_right_name_1;
146     PyObject *tmp_right_name_2; 145     PyObject *tmp_right_name_2;
240 239
241     tmp_left_name_1 = var_local_value; 240     tmp_left_name_1 = var_local_value;
242 241
243     CHECK_OBJECT( tmp_left_name_1 ); 242     CHECK_OBJECT( tmp_left_name_1 );
244     tmp_right_name_1 = const_int_pos_2; 243     tmp_right_name_1 = const_int_pos_2;
n 245     tmp_assign_source_3 = BINARY_OPERATION_MUL( tmp_left_name_1, tmp_right_name_1 ); n 244     tmp_unused = BINARY_OPERATION_MUL( tmp_left_name_1, tmp_right_name_1 );
246     if ( tmp_assign_source_3 == NULL ) 245     if ( tmp_unused == NULL )
247     { 246     {
248         assert( ERROR_OCCURRED() ); 247         assert( ERROR_OCCURRED() );
249 248
250         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 249         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
251 250
252 251
n 253         exception_lineno = 31; n 252         exception_lineno = 33;
254         type_description = "oo"; 253         type_description = "oo";
255         goto frame_exception_exit_1; 254         goto frame_exception_exit_1;
256     } 255     }
n 257     { n 256     Py_DECREF( tmp_unused );
258         PyObject *old = var_local_value2;
259         var_local_value2 = tmp_assign_source_3;
260         Py_XDECREF( old );
261     }
262  
263     tmp_left_name_2 = var_local_value; 257     tmp_left_name_2 = var_local_value;
264 258
265     if ( tmp_left_name_2 == NULL ) 259     if ( tmp_left_name_2 == NULL )
266     { 260     {
267 261
276         type_description = "oo"; 270         type_description = "oo";
277         goto frame_exception_exit_1; 271         goto frame_exception_exit_1;
278     } 272     }
279 273
280     tmp_right_name_2 = const_int_pos_4; 274     tmp_right_name_2 = const_int_pos_4;
n 281     tmp_assign_source_4 = BINARY_OPERATION_MUL( tmp_left_name_2, tmp_right_name_2 ); n 275     tmp_assign_source_3 = BINARY_OPERATION_MUL( tmp_left_name_2, tmp_right_name_2 );
282     if ( tmp_assign_source_4 == NULL ) 276     if ( tmp_assign_source_3 == NULL )
283     { 277     {
284         assert( ERROR_OCCURRED() ); 278         assert( ERROR_OCCURRED() );
285 279
286         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 280         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
287 281
290         type_description = "oo"; 284         type_description = "oo";
291         goto frame_exception_exit_1; 285         goto frame_exception_exit_1;
292     } 286     }
293     { 287     {
294         PyObject *old = var_local_value2; 288         PyObject *old = var_local_value2;
t 295         var_local_value2 = tmp_assign_source_4; t 289         var_local_value2 = tmp_assign_source_3;
296         Py_XDECREF( old ); 290         Py_XDECREF( old );
297     } 291     }
298 292
299     tmp_return_value = var_local_value; 293     tmp_return_value = var_local_value;
300 294