Construct BuiltinSumWithTuple

Performance Diagrams

Construct BuiltinSumWithTuple 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1618726488.95192307692307257.0CPython 2.712199952242.31730769230768317.87045583870986Nuitka (master)12199988395.6826923076923317.869906261348Nuitka (develop)12200018549.0480769230769317.86944828021296Nuitka (factory)Construct BuiltinSumWithTupleTicks Construct BuiltinSumWithTuple 004000000400000080000008000000120000001200000016000000160000002000000020000000240000002400000028000000280000003200000032000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3309663188.95192307692307257.0CPython 3.526455854242.31730769230768306.58323892543626Nuitka (master)26457727395.6826923076923306.5692542054995Nuitka (develop)26459049549.0480769230769306.5593835168949Nuitka (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
211 211
212     assert( var_x == NULL ); 212     assert( var_x == NULL );
213     Py_INCREF( tmp_assign_source_1 ); 213     Py_INCREF( tmp_assign_source_1 );
214     var_x = tmp_assign_source_1; 214     var_x = tmp_assign_source_1;
215 215
n 216     tmp_sum_sequence_1 = var_x; n 216     tmp_sum_sequence_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_empty );
217 217
n 218     CHECK_OBJECT( tmp_sum_sequence_1 ); n 218     if (unlikely( tmp_sum_sequence_1 == NULL ))
219     {
220         tmp_sum_sequence_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_empty );
221     }
222  
223     if ( tmp_sum_sequence_1 == NULL )
224     {
225  
226         exception_type = PyExc_NameError;
227         Py_INCREF( exception_type );
228         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "empty" );
229         exception_tb = NULL;
230         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
231         CHAIN_EXCEPTION( exception_value );
232  
233         exception_lineno = 33;
234         type_description_1 = "oo";
235         goto frame_exception_exit_1;
236     }
237  
219     tmp_assign_source_2 = BUILTIN_SUM1( tmp_sum_sequence_1 ); 238     tmp_assign_source_2 = BUILTIN_SUM1( tmp_sum_sequence_1 );
220     if ( tmp_assign_source_2 == NULL ) 239     if ( tmp_assign_source_2 == NULL )
221     { 240     {
222         assert( ERROR_OCCURRED() ); 241         assert( ERROR_OCCURRED() );
223 242
224         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 243         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
225 244
226 245
t 227         exception_lineno = 31; t 246         exception_lineno = 33;
228         type_description_1 = "oo"; 247         type_description_1 = "oo";
229         goto frame_exception_exit_1; 248         goto frame_exception_exit_1;
230     } 249     }
231     assert( var_y == NULL ); 250     assert( var_y == NULL );
232     var_y = tmp_assign_source_2; 251     var_y = tmp_assign_source_2;