Construct BuiltinSumWithTuple

Performance Diagrams

Construct BuiltinSumWithTuple 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1583126788.95192307692307257.0CPython 2.712550012242.31730769230768308.21817422106227Nuitka (master)12549891395.6826923076923308.2200629493326Nuitka (develop)12549873549.0480769230769308.2203439171745Nuitka (factory)Construct BuiltinSumWithTupleTicks Construct BuiltinSumWithTuple 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000260000002600000028000000280000003000000030000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3169641688.95192307692307257.0CPython 3.524900993242.31730769230768309.9792885185893Nuitka (master)24896566395.6826923076923310.0138028248028Nuitka (develop)24896667549.0480769230769310.0130153965381Nuitka (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
70 static bool constants_created = false; 70 static bool constants_created = false;
71 71
72 /* Function to create module private constants. */ 72 /* Function to create module private constants. */
73 static void createModuleConstants( void ) 73 static void createModuleConstants( void )
74 { 74 {
n 75     const_str_plain_itertools = UNSTREAM_STRING_ASCII( &constant_bin[ 65 ], 9, 1 ); n 75     const_str_plain_itertools = UNSTREAM_STRING_ASCII( &constant_bin[ 92 ], 9, 1 );
76     const_str_plain_False = UNSTREAM_STRING_ASCII( &constant_bin[ 74 ], 5, 1 ); 76     const_str_plain_False = UNSTREAM_STRING_ASCII( &constant_bin[ 101 ], 5, 1 );
77     const_str_plain_y = UNSTREAM_STRING_ASCII( &constant_bin[ 48 ], 1, 1 ); 77     const_str_plain_y = UNSTREAM_STRING_ASCII( &constant_bin[ 37 ], 1, 1 );
78     const_int_pos_9 = PyLong_FromUnsignedLong(9ul); 78     const_int_pos_9 = PyLong_FromUnsignedLong(9ul);
79     const_str_plain_value = UNSTREAM_STRING_ASCII( &constant_bin[ 6 ], 5, 1 ); 79     const_str_plain_value = UNSTREAM_STRING_ASCII( &constant_bin[ 6 ], 5, 1 );
n 80     const_str_plain_empty = UNSTREAM_STRING_ASCII( &constant_bin[ 79 ], 5, 1 ); n 80     const_str_plain_empty = UNSTREAM_STRING_ASCII( &constant_bin[ 33 ], 5, 1 );
81     const_int_pos_3 = PyLong_FromUnsignedLong(3ul); 81     const_int_pos_3 = PyLong_FromUnsignedLong(3ul);
82     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul); 82     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
83     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 ); 83     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New( 1 );
n 84     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 84 ], 3, 0 ); n 84     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII( &constant_bin[ 106 ], 3, 0 );
85     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352); 85     PyTuple_SET_ITEM( const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352 ); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352);
86     const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple = PyTuple_New( 10 ); 86     const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple = PyTuple_New( 10 );
87     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 0, const_int_0 ); Py_INCREF(const_int_0); 87     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 0, const_int_0 ); Py_INCREF(const_int_0);
88     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 1, const_int_pos_1 ); Py_INCREF(const_int_pos_1); 88     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 1, const_int_pos_1 ); Py_INCREF(const_int_pos_1);
89     const_int_pos_2 = PyLong_FromUnsignedLong(2ul); 89     const_int_pos_2 = PyLong_FromUnsignedLong(2ul);
98     const_int_pos_7 = PyLong_FromUnsignedLong(7ul); 98     const_int_pos_7 = PyLong_FromUnsignedLong(7ul);
99     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 7, const_int_pos_7 ); Py_INCREF(const_int_pos_7); 99     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 7, const_int_pos_7 ); Py_INCREF(const_int_pos_7);
100     const_int_pos_8 = PyLong_FromUnsignedLong(8ul); 100     const_int_pos_8 = PyLong_FromUnsignedLong(8ul);
101     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 8, const_int_pos_8 ); Py_INCREF(const_int_pos_8); 101     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 8, const_int_pos_8 ); Py_INCREF(const_int_pos_8);
102     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 9, const_int_pos_9 ); Py_INCREF(const_int_pos_9); 102     PyTuple_SET_ITEM( const_tuple_f574c86ffc3b1d2f77c150b7cab373d2_tuple, 9, const_int_pos_9 ); Py_INCREF(const_int_pos_9);
n 103     const_str_digest_e907d1b186d8df194f04fa0dbcd7942c = UNSTREAM_STRING_ASCII( &constant_bin[ 87 ], 44, 0 ); n 103     const_str_digest_e907d1b186d8df194f04fa0dbcd7942c = UNSTREAM_STRING_ASCII( &constant_bin[ 109 ], 44, 0 );
104     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 33 ], 16, 1 ); 104     const_str_plain_calledRepeatedly = UNSTREAM_STRING_ASCII( &constant_bin[ 60 ], 16, 1 );
105     const_tuple_str_plain_y_str_plain_x_tuple = PyTuple_New( 2 ); 105     const_tuple_str_plain_y_str_plain_x_tuple = PyTuple_New( 2 );
106     PyTuple_SET_ITEM( const_tuple_str_plain_y_str_plain_x_tuple, 0, const_str_plain_y ); Py_INCREF(const_str_plain_y); 106     PyTuple_SET_ITEM( const_tuple_str_plain_y_str_plain_x_tuple, 0, const_str_plain_y ); Py_INCREF(const_str_plain_y);
n 107     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 106 ], 1, 1 ); n 107     const_str_plain_x = UNSTREAM_STRING_ASCII( &constant_bin[ 128 ], 1, 1 );
108     PyTuple_SET_ITEM( const_tuple_str_plain_y_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF(const_str_plain_x); 108     PyTuple_SET_ITEM( const_tuple_str_plain_y_str_plain_x_tuple, 1, const_str_plain_x ); Py_INCREF(const_str_plain_x);
n 109     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 131 ], 8, 0 ); n 109     const_str_angle_module = UNSTREAM_STRING_ASCII( &constant_bin[ 153 ], 8, 0 );
110     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 139 ], 4, 1 ); 110     const_str_plain_None = UNSTREAM_STRING_ASCII( &constant_bin[ 161 ], 4, 1 );
111     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 143 ], 6, 1 ); 111     const_str_plain_repeat = UNSTREAM_STRING_ASCII( &constant_bin[ 165 ], 6, 1 );
112     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 ); 112     const_tuple_none_int_pos_50000_tuple = PyTuple_New( 2 );
113     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF(Py_None); 113     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 0, Py_None ); Py_INCREF(Py_None);
114     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF(const_int_pos_50000); 114     PyTuple_SET_ITEM( const_tuple_none_int_pos_50000_tuple, 1, const_int_pos_50000 ); Py_INCREF(const_int_pos_50000);
n 115     const_str_plain___debug__ = UNSTREAM_STRING_ASCII( &constant_bin[ 149 ], 9, 1 ); n 115     const_str_plain___debug__ = UNSTREAM_STRING_ASCII( &constant_bin[ 171 ], 9, 1 );
116 116
117     constants_created = true; 117     constants_created = true;
118 } 118 }
119 119
120 /* Function to verify module private constants for non-corruption. */ 120 /* Function to verify module private constants for non-corruption. */
211         var_x = tmp_assign_source_1; 211         var_x = tmp_assign_source_1;
212     } 212     }
213     { 213     {
214         PyObject *tmp_assign_source_2; 214         PyObject *tmp_assign_source_2;
215         PyObject *tmp_sum_sequence_1; 215         PyObject *tmp_sum_sequence_1;
n 216         CHECK_OBJECT(var_x); n 216         PyObject *tmp_mvar_value_2;
217         tmp_mvar_value_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_empty);
218  
219         if (unlikely( tmp_mvar_value_2 == NULL )) {
220             tmp_mvar_value_2 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_empty);
221         }
222  
223         if ( tmp_mvar_value_2 == NULL )
224         {
225  
226             exception_type = PyExc_NameError;
227             Py_INCREF(exception_type);
228             exception_value = UNSTREAM_STRING( &constant_bin[ 27 ], 27, 0 );
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  
217         tmp_sum_sequence_1 = var_x; 238         tmp_sum_sequence_1 = tmp_mvar_value_2;
218         tmp_assign_source_2 = BUILTIN_SUM1( tmp_sum_sequence_1 ); 239         tmp_assign_source_2 = BUILTIN_SUM1( tmp_sum_sequence_1 );
219         if ( tmp_assign_source_2 == NULL ) 240         if ( tmp_assign_source_2 == NULL )
220         { 241         {
221             assert(ERROR_OCCURRED()); 242             assert(ERROR_OCCURRED());
222 243
223             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 244             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
224 245
225 246
n 226             exception_lineno = 31; n 247             exception_lineno = 33;
227             type_description_1 = "oo"; 248             type_description_1 = "oo";
228             goto frame_exception_exit_1; 249             goto frame_exception_exit_1;
229         } 250         }
230         assert(var_y == NULL); 251         assert(var_y == NULL);
231         var_y = tmp_assign_source_2; 252         var_y = tmp_assign_source_2;
809         if ( tmp_mvar_value_2 == NULL ) 830         if ( tmp_mvar_value_2 == NULL )
810         { 831         {
811 832
812             exception_type = PyExc_NameError; 833             exception_type = PyExc_NameError;
813             Py_INCREF(exception_type); 834             Py_INCREF(exception_type);
t 814             exception_value = UNSTREAM_STRING( &constant_bin[ 27 ], 38, 0 ); t 835             exception_value = UNSTREAM_STRING( &constant_bin[ 54 ], 38, 0 );
815             exception_tb = NULL; 836             exception_tb = NULL;
816             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 837             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
817             CHAIN_EXCEPTION( exception_value ); 838             CHAIN_EXCEPTION( exception_value );
818 839
819             exception_lineno = 40; 840             exception_lineno = 40;