Construct SetCreation

Performance Diagrams

Construct SetCreation 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)5594141988.95192307692307257.0CPython 2.745351917242.31730769230768303.7780207651756Nuitka (master)45352232395.6826923076923303.77662928552513Nuitka (develop)45351863549.0480769230769303.77825930454424Nuitka (factory)Construct SetCreationTicks Construct SetCreation 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)7295868888.95192307692307257.00000000000006CPython 3.553400819242.31730769230768323.24365723506855Nuitka (master)53405752395.6826923076923323.22694887276486Nuitka (develop)53406380549.0480769230769323.22482179968017Nuitka (factory)Construct SetCreationTicks

Source Code with Construct

module_value1 = 1000

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

# construct_begin
    l = {
        module_value1,
        module_value1,
        module_value1,
        module_value1,
        module_value1
    }
# construct_alternative


# construct_end

    return l

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

print("OK.")

Source Code without Construct

module_value1 = 1000

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

# construct_begin







# construct_alternative
    l = 1
# construct_end
# construct_end

    return l

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

print("OK.")

Context Diff of Source Code


Construct
Baseline
22 def calledRepeatedly(): 22 def calledRepeatedly():
23     # Force frame and eliminate forward propagation (currently). 23     # Force frame and eliminate forward propagation (currently).
24     module_value1 24     module_value1
25 25
26 # construct_begin 26 # construct_begin
n 27     l = { n
28         module_value1,
29         module_value1,
30         module_value1,
31         module_value1,
32         module_value1
33     }
34 # construct_alternative
35 27
36 28
t t 29  
30  
31  
32  
33  
34 # construct_alternative
35     l = 1
36 # construct_end
37 # construct_end 37 # construct_end
38 38
39     return l 39     return l
40 40
41 import itertools 41 import itertools

Context Diff of Generated Code


Construct
Baseline
33 /* The module constants used, if any. */ 33 /* The module constants used, if any. */
34 static PyObject *const_str_plain_itertools; 34 static PyObject *const_str_plain_itertools;
35 static PyObject *const_tuple_str_plain_l_tuple; 35 static PyObject *const_tuple_str_plain_l_tuple;
36 static PyObject *const_str_plain___package__; 36 static PyObject *const_str_plain___package__;
37 static PyObject *const_str_plain___spec__; 37 static PyObject *const_str_plain___spec__;
n n 38 extern PyObject *const_int_pos_1;
38 extern PyObject *const_dict_empty; 39 extern PyObject *const_dict_empty;
39 extern PyObject *const_str_plain___file__; 40 extern PyObject *const_str_plain___file__;
40 extern PyObject *const_int_0; 41 extern PyObject *const_int_0;
41 extern PyObject *const_str_plain_print; 42 extern PyObject *const_str_plain_print;
42 static PyObject *const_int_pos_50000; 43 static PyObject *const_int_pos_50000;
121 #ifndef __NUITKA_NO_ASSERT__ 122 #ifndef __NUITKA_NO_ASSERT__
122     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED(); 123     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
123 #endif 124 #endif
124 125
125     // Local variable declarations. 126     // Local variable declarations.
n 126     PyObject *var_l = NULL; n
127     PyObject *exception_type = NULL; 127     PyObject *exception_type = NULL;
128     PyObject *exception_value = NULL; 128     PyObject *exception_value = NULL;
129     PyTracebackObject *exception_tb = NULL; 129     PyTracebackObject *exception_tb = NULL;
130     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 130     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
131     PyObject *exception_keeper_type_1; 131     PyObject *exception_keeper_type_1;
132     PyObject *exception_keeper_value_1; 132     PyObject *exception_keeper_value_1;
133     PyTracebackObject *exception_keeper_tb_1; 133     PyTracebackObject *exception_keeper_tb_1;
134     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 134     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
n 135     PyObject *tmp_assign_source_1; n
136     int tmp_res;
137     PyObject *tmp_return_value; 135     PyObject *tmp_return_value;
n 138     PyObject *tmp_set_element_1_1; n
139     PyObject *tmp_set_element_2_1;
140     PyObject *tmp_set_element_3_1;
141     PyObject *tmp_set_element_4_1;
142     PyObject *tmp_set_element_5_1;
143     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 136     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
144     static struct Nuitka_FrameObject *cache_frame_eec4dbd43e450fea4906dce39b446210 = NULL; 137     static struct Nuitka_FrameObject *cache_frame_eec4dbd43e450fea4906dce39b446210 = NULL;
145 138
146     struct Nuitka_FrameObject *frame_eec4dbd43e450fea4906dce39b446210; 139     struct Nuitka_FrameObject *frame_eec4dbd43e450fea4906dce39b446210;
147 140
176         exception_tb = NULL; 169         exception_tb = NULL;
177         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 170         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
178         CHAIN_EXCEPTION( exception_value ); 171         CHAIN_EXCEPTION( exception_value );
179 172
180         exception_lineno = 24; 173         exception_lineno = 24;
n 181         type_description_1 = "o"; n 174         type_description_1 = "N";
182         goto frame_exception_exit_1; 175         goto frame_exception_exit_1;
183     } 176     }
n 184   n
185     tmp_assign_source_1 = PySet_New( NULL );
186     tmp_set_element_1_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
187  
188     if (unlikely( tmp_set_element_1_1 == NULL ))
189     {
190         tmp_set_element_1_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
191     }
192  
193     if ( tmp_set_element_1_1 == NULL )
194     {
195         Py_DECREF( tmp_assign_source_1 );
196         exception_type = PyExc_NameError;
197         Py_INCREF( exception_type );
198         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
199         exception_tb = NULL;
200         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
201         CHAIN_EXCEPTION( exception_value );
202  
203         exception_lineno = 28;
204         type_description_1 = "o";
205         goto frame_exception_exit_1;
206     }
207  
208     tmp_set_element_2_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
209  
210     if (unlikely( tmp_set_element_2_1 == NULL ))
211     {
212         tmp_set_element_2_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
213     }
214  
215     if ( tmp_set_element_2_1 == NULL )
216     {
217         Py_DECREF( tmp_assign_source_1 );
218         exception_type = PyExc_NameError;
219         Py_INCREF( exception_type );
220         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
221         exception_tb = NULL;
222         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
223         CHAIN_EXCEPTION( exception_value );
224  
225         exception_lineno = 29;
226         type_description_1 = "o";
227         goto frame_exception_exit_1;
228     }
229  
230     tmp_set_element_3_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
231  
232     if (unlikely( tmp_set_element_3_1 == NULL ))
233     {
234         tmp_set_element_3_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
235     }
236  
237     if ( tmp_set_element_3_1 == NULL )
238     {
239         Py_DECREF( tmp_assign_source_1 );
240         exception_type = PyExc_NameError;
241         Py_INCREF( exception_type );
242         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
243         exception_tb = NULL;
244         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
245         CHAIN_EXCEPTION( exception_value );
246  
247         exception_lineno = 30;
248         type_description_1 = "o";
249         goto frame_exception_exit_1;
250     }
251  
252     tmp_set_element_4_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
253  
254     if (unlikely( tmp_set_element_4_1 == NULL ))
255     {
256         tmp_set_element_4_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
257     }
258  
259     if ( tmp_set_element_4_1 == NULL )
260     {
261         Py_DECREF( tmp_assign_source_1 );
262         exception_type = PyExc_NameError;
263         Py_INCREF( exception_type );
264         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
265         exception_tb = NULL;
266         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
267         CHAIN_EXCEPTION( exception_value );
268  
269         exception_lineno = 31;
270         type_description_1 = "o";
271         goto frame_exception_exit_1;
272     }
273  
274     tmp_set_element_5_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
275  
276     if (unlikely( tmp_set_element_5_1 == NULL ))
277     {
278         tmp_set_element_5_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
279     }
280  
281     if ( tmp_set_element_5_1 == NULL )
282     {
283         Py_DECREF( tmp_assign_source_1 );
284         exception_type = PyExc_NameError;
285         Py_INCREF( exception_type );
286         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
287         exception_tb = NULL;
288         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
289         CHAIN_EXCEPTION( exception_value );
290  
291         exception_lineno = 32;
292         type_description_1 = "o";
293         goto frame_exception_exit_1;
294     }
295  
296     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_5_1 );
297     if ( tmp_res != 0 )
298     {
299         assert( ERROR_OCCURRED() );
300  
301         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
302         Py_DECREF( tmp_assign_source_1 );
303  
304         exception_lineno = 27;
305         type_description_1 = "o";
306         goto frame_exception_exit_1;
307     }
308     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_4_1 );
309     if ( tmp_res != 0 )
310     {
311         assert( ERROR_OCCURRED() );
312  
313         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
314         Py_DECREF( tmp_assign_source_1 );
315  
316         exception_lineno = 27;
317         type_description_1 = "o";
318         goto frame_exception_exit_1;
319     }
320     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_3_1 );
321     if ( tmp_res != 0 )
322     {
323         assert( ERROR_OCCURRED() );
324  
325         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
326         Py_DECREF( tmp_assign_source_1 );
327  
328         exception_lineno = 27;
329         type_description_1 = "o";
330         goto frame_exception_exit_1;
331     }
332     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_2_1 );
333     if ( tmp_res != 0 )
334     {
335         assert( ERROR_OCCURRED() );
336  
337         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
338         Py_DECREF( tmp_assign_source_1 );
339  
340         exception_lineno = 27;
341         type_description_1 = "o";
342         goto frame_exception_exit_1;
343     }
344     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1_1 );
345     if ( tmp_res != 0 )
346     {
347         assert( ERROR_OCCURRED() );
348  
349         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
350         Py_DECREF( tmp_assign_source_1 );
351  
352         exception_lineno = 27;
353         type_description_1 = "o";
354         goto frame_exception_exit_1;
355     }
356     assert( var_l == NULL );
357     var_l = tmp_assign_source_1;
358 177
359 178
360 #if 0 179 #if 0
361     RESTORE_FRAME_EXCEPTION( frame_eec4dbd43e450fea4906dce39b446210 ); 180     RESTORE_FRAME_EXCEPTION( frame_eec4dbd43e450fea4906dce39b446210 );
362 #endif 181 #endif
383 202
384     // Attachs locals to frame if any. 203     // Attachs locals to frame if any.
385     Nuitka_Frame_AttachLocals( 204     Nuitka_Frame_AttachLocals(
386         (struct Nuitka_FrameObject *)frame_eec4dbd43e450fea4906dce39b446210, 205         (struct Nuitka_FrameObject *)frame_eec4dbd43e450fea4906dce39b446210,
387         type_description_1, 206         type_description_1,
n 388         var_l n 207         NULL
389     ); 208     );
390 209
391 210
392     // Release cached frame. 211     // Release cached frame.
393     if ( frame_eec4dbd43e450fea4906dce39b446210 == cache_frame_eec4dbd43e450fea4906dce39b446210 ) 212     if ( frame_eec4dbd43e450fea4906dce39b446210 == cache_frame_eec4dbd43e450fea4906dce39b446210 )
404     // Return the error. 223     // Return the error.
405     goto try_except_handler_1; 224     goto try_except_handler_1;
406 225
407     frame_no_exception_1:; 226     frame_no_exception_1:;
408 227
n 409     tmp_return_value = var_l; n
410  
411     CHECK_OBJECT( tmp_return_value );
412     Py_INCREF( tmp_return_value );
413     goto try_return_handler_1; 228     goto try_end_1;
414     // tried codes exits in all cases
415     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
416     return NULL;
417     // Return handler code:
418     try_return_handler_1:;
419     CHECK_OBJECT( (PyObject *)var_l );
420     Py_DECREF( var_l );
421     var_l = NULL;
422  
423     goto function_return_exit;
424     // Exception handler code: 229     // Exception handler code:
425     try_except_handler_1:; 230     try_except_handler_1:;
426     exception_keeper_type_1 = exception_type; 231     exception_keeper_type_1 = exception_type;
427     exception_keeper_value_1 = exception_value; 232     exception_keeper_value_1 = exception_value;
428     exception_keeper_tb_1 = exception_tb; 233     exception_keeper_tb_1 = exception_tb;
438     exception_tb = exception_keeper_tb_1; 243     exception_tb = exception_keeper_tb_1;
439     exception_lineno = exception_keeper_lineno_1; 244     exception_lineno = exception_keeper_lineno_1;
440 245
441     goto function_exception_exit; 246     goto function_exception_exit;
442     // End of try: 247     // End of try:
t t 248     try_end_1:;
249     tmp_return_value = const_int_pos_1;
250     Py_INCREF( tmp_return_value );
251     goto function_return_exit;
443 252
444     // Return statement must have exited already. 253     // Return statement must have exited already.
445     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 254     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
446     return NULL; 255     return NULL;
447 256