Construct BuiltinSumWithList

Performance Diagrams

Construct BuiltinSumWithList 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)1618721673.61538461538461335.3344956011945CPython 2.723700018196.30769230769232257.0Nuitka (historic)14000006319.0000000000001358.1401002376389Nuitka (master)14000000441.69230769230774358.1401627984483Nuitka (develop)14000012564.3846153846155358.1400376768296Nuitka (factory)Construct BuiltinSumWithListTicks Construct BuiltinSumWithList 004000000400000080000008000000120000001200000016000000160000002000000020000000240000002400000028000000280000003200000032000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)3309624973.61538461538461257.0CPython 3.50196.30769230769232504.11538461538464Nuitka (historic)28248442319.0000000000001293.1964792851949Nuitka (master)28252402441.69230769230774293.1669116770023Nuitka (develop)28249948564.3846153846155293.18523463420047Nuitka (factory)Construct BuiltinSumWithListTicks

Source Code with Construct

empty = ()

value = list(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

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

empty = ()

value = list(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

for x in xrange(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 for x in xrange(50000): 38 for x in xrange(50000):
39     calledRepeatedly() 39     calledRepeatedly()

Context Diff of Generated Code


Construct
Baseline
201 201
202     assert( var_x == NULL ); 202     assert( var_x == NULL );
203     Py_INCREF( tmp_assign_source_1 ); 203     Py_INCREF( tmp_assign_source_1 );
204     var_x = tmp_assign_source_1; 204     var_x = tmp_assign_source_1;
205 205
n 206     tmp_sum_sequence_1 = var_x; n 206     tmp_sum_sequence_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_empty );
207 207
n 208     CHECK_OBJECT( tmp_sum_sequence_1 ); n 208     if (unlikely( tmp_sum_sequence_1 == NULL ))
209     {
210         tmp_sum_sequence_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_empty );
211     }
212  
213     if ( tmp_sum_sequence_1 == NULL )
214     {
215  
216         exception_type = PyExc_NameError;
217         Py_INCREF( exception_type );
218         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "empty" );
219         exception_tb = NULL;
220         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
221         CHAIN_EXCEPTION( exception_value );
222  
223         exception_lineno = 33;
224         type_description = "oo";
225         goto frame_exception_exit_1;
226     }
227  
209     tmp_assign_source_2 = BUILTIN_SUM1( tmp_sum_sequence_1 ); 228     tmp_assign_source_2 = BUILTIN_SUM1( tmp_sum_sequence_1 );
210     if ( tmp_assign_source_2 == NULL ) 229     if ( tmp_assign_source_2 == NULL )
211     { 230     {
212         assert( ERROR_OCCURRED() ); 231         assert( ERROR_OCCURRED() );
213 232
214         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); 233         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
215 234
216 235
t 217         exception_lineno = 31; t 236         exception_lineno = 33;
218         type_description = "oo"; 237         type_description = "oo";
219         goto frame_exception_exit_1; 238         goto frame_exception_exit_1;
220     } 239     }
221     assert( var_y == NULL ); 240     assert( var_y == NULL );
222     var_y = tmp_assign_source_2; 241     var_y = tmp_assign_source_2;