Construct BuiltinSumWithTuple

Performance Diagrams

Construct BuiltinSumWithTuple 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)2043353388.95192307692307257.0CPython 2.712600072242.31730769230768351.7349011002951Nuitka (master)12600048395.6826923076923351.73519134717657Nuitka (develop)12600072549.0480769230769351.7349011002951Nuitka (factory)Construct BuiltinSumWithTupleTicks Construct BuiltinSumWithTuple 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000260000002600000028000000280000003000000030000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3119845888.95192307692307257.0CPython 3.527251113242.31730769230768288.26595801255996Nuitka (master)27250935395.6826923076923288.267367907192Nuitka (develop)27249171549.0480769230769288.2813401214105Nuitka (factory)Construct BuiltinSumWithTupleTicks

Source Code with Construct

empty = ()

value = tuple(range(10))

def calledRepeatedly():
    # We measure making a generator iterator step or not.
    x = value

    # This should abort.
# construct_begin
    y = sum(x)
# construct_alternative



    return x, y

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

empty = ()

value = tuple(range(10))

def calledRepeatedly():
    # We measure making a generator iterator step or not.
    x = value

    # This should abort.
# construct_begin

# construct_alternative
    y = sum(empty)
# construct_end

    return x, y

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
26     # We measure making a generator iterator step or not. 26     # We measure making a generator iterator step or not.
27     x = value 27     x = value
28 28
29     # This should abort. 29     # This should abort.
30 # construct_begin 30 # construct_begin
n 31     y = sum(x) n 31  
32 # construct_alternative 32 # construct_alternative
t 33   t 33     y = sum(empty)
34   34 # construct_end
35 35
36     return x, y 36     return x, y
37 37
38 import itertools 38 import itertools
39 for x in itertools.repeat(None, 50000): 39 for x in itertools.repeat(None, 50000):

Context Diff of Generated Code


Construct
Baseline
213         var_x = tmp_assign_source_1; 213         var_x = tmp_assign_source_1;
214     } 214     }
215     { 215     {
216         PyObject *tmp_assign_source_2; 216         PyObject *tmp_assign_source_2;
217         PyObject *tmp_sum_sequence_1; 217         PyObject *tmp_sum_sequence_1;
n 218         CHECK_OBJECT( var_x ); n 218         PyObject *tmp_mvar_value_2;
219         tmp_mvar_value_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_empty );
220  
221         if (unlikely( tmp_mvar_value_2 == NULL ))
222         {
223             tmp_mvar_value_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_empty );
224         }
225  
226         if ( tmp_mvar_value_2 == NULL )
227         {
228  
229             exception_type = PyExc_NameError;
230             Py_INCREF( exception_type );
231             exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "empty" );
232             exception_tb = NULL;
233             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
234             CHAIN_EXCEPTION( exception_value );
235  
236             exception_lineno = 33;
237             type_description_1 = "oo";
238             goto frame_exception_exit_1;
239         }
240  
219         tmp_sum_sequence_1 = var_x; 241         tmp_sum_sequence_1 = tmp_mvar_value_2;
220         tmp_assign_source_2 = BUILTIN_SUM1( tmp_sum_sequence_1 ); 242         tmp_assign_source_2 = BUILTIN_SUM1( tmp_sum_sequence_1 );
221         if ( tmp_assign_source_2 == NULL ) 243         if ( tmp_assign_source_2 == NULL )
222         { 244         {
223             assert( ERROR_OCCURRED() ); 245             assert( ERROR_OCCURRED() );
224 246
225             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 247             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
226 248
227 249
t 228             exception_lineno = 31; t 250             exception_lineno = 33;
229             type_description_1 = "oo"; 251             type_description_1 = "oo";
230             goto frame_exception_exit_1; 252             goto frame_exception_exit_1;
231         } 253         }
232         assert( var_y == NULL ); 254         assert( var_y == NULL );
233         var_y = tmp_assign_source_2; 255         var_y = tmp_assign_source_2;