Construct SetCreation

Performance Diagrams

Construct SetCreation 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6372645988.95192307692307257.0CPython 2.746152041242.31730769230768325.1492292465448Nuitka (master)46151885395.6826923076923325.14983417580976Nuitka (develop)46152016549.0480769230769325.14932619033726Nuitka (factory)Construct SetCreationTicks Construct SetCreation 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)7430176388.95192307692307257.00000000000006CPython 3.554153044242.31730769230768324.0113096131018Nuitka (master)54153014395.6826923076923324.011409388144Nuitka (develop)54153042549.0480769230769324.01131626477127Nuitka (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; n
139     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 136     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
140     static struct Nuitka_FrameObject *cache_frame_b8b1bbf70d7021b7960836dd920aa2df = NULL; 137     static struct Nuitka_FrameObject *cache_frame_b8b1bbf70d7021b7960836dd920aa2df = NULL;
141 138
142     struct Nuitka_FrameObject *frame_b8b1bbf70d7021b7960836dd920aa2df; 139     struct Nuitka_FrameObject *frame_b8b1bbf70d7021b7960836dd920aa2df;
143 140
172         exception_tb = NULL; 169         exception_tb = NULL;
173         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 170         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
174         CHAIN_EXCEPTION( exception_value ); 171         CHAIN_EXCEPTION( exception_value );
175 172
176         exception_lineno = 24; 173         exception_lineno = 24;
n 177         type_description_1 = "o"; n 174         type_description_1 = "N";
178         goto frame_exception_exit_1; 175         goto frame_exception_exit_1;
179     } 176     }
n 180   n
181     tmp_assign_source_1 = PySet_New( NULL );
182     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
183  
184     if (unlikely( tmp_set_element_1 == NULL ))
185     {
186         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
187     }
188  
189     if ( tmp_set_element_1 == NULL )
190     {
191         Py_DECREF( tmp_assign_source_1 );
192         exception_type = PyExc_NameError;
193         Py_INCREF( exception_type );
194         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
195         exception_tb = NULL;
196         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
197         CHAIN_EXCEPTION( exception_value );
198  
199         exception_lineno = 28;
200         type_description_1 = "o";
201         goto frame_exception_exit_1;
202     }
203  
204     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
205     if ( tmp_res != 0 )
206     {
207         assert( ERROR_OCCURRED() );
208  
209         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
210         Py_DECREF( tmp_assign_source_1 );
211  
212         exception_lineno = 27;
213         type_description_1 = "o";
214         goto frame_exception_exit_1;
215     }
216     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
217  
218     if (unlikely( tmp_set_element_1 == NULL ))
219     {
220         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
221     }
222  
223     if ( tmp_set_element_1 == NULL )
224     {
225         Py_DECREF( tmp_assign_source_1 );
226         exception_type = PyExc_NameError;
227         Py_INCREF( exception_type );
228         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
229         exception_tb = NULL;
230         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
231         CHAIN_EXCEPTION( exception_value );
232  
233         exception_lineno = 29;
234         type_description_1 = "o";
235         goto frame_exception_exit_1;
236     }
237  
238     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
239     if ( tmp_res != 0 )
240     {
241         assert( ERROR_OCCURRED() );
242  
243         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
244         Py_DECREF( tmp_assign_source_1 );
245  
246         exception_lineno = 27;
247         type_description_1 = "o";
248         goto frame_exception_exit_1;
249     }
250     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
251  
252     if (unlikely( tmp_set_element_1 == NULL ))
253     {
254         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
255     }
256  
257     if ( tmp_set_element_1 == NULL )
258     {
259         Py_DECREF( tmp_assign_source_1 );
260         exception_type = PyExc_NameError;
261         Py_INCREF( exception_type );
262         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
263         exception_tb = NULL;
264         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
265         CHAIN_EXCEPTION( exception_value );
266  
267         exception_lineno = 30;
268         type_description_1 = "o";
269         goto frame_exception_exit_1;
270     }
271  
272     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
273     if ( tmp_res != 0 )
274     {
275         assert( ERROR_OCCURRED() );
276  
277         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
278         Py_DECREF( tmp_assign_source_1 );
279  
280         exception_lineno = 27;
281         type_description_1 = "o";
282         goto frame_exception_exit_1;
283     }
284     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
285  
286     if (unlikely( tmp_set_element_1 == NULL ))
287     {
288         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
289     }
290  
291     if ( tmp_set_element_1 == NULL )
292     {
293         Py_DECREF( tmp_assign_source_1 );
294         exception_type = PyExc_NameError;
295         Py_INCREF( exception_type );
296         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
297         exception_tb = NULL;
298         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
299         CHAIN_EXCEPTION( exception_value );
300  
301         exception_lineno = 31;
302         type_description_1 = "o";
303         goto frame_exception_exit_1;
304     }
305  
306     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
307     if ( tmp_res != 0 )
308     {
309         assert( ERROR_OCCURRED() );
310  
311         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
312         Py_DECREF( tmp_assign_source_1 );
313  
314         exception_lineno = 27;
315         type_description_1 = "o";
316         goto frame_exception_exit_1;
317     }
318     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
319  
320     if (unlikely( tmp_set_element_1 == NULL ))
321     {
322         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
323     }
324  
325     if ( tmp_set_element_1 == NULL )
326     {
327         Py_DECREF( tmp_assign_source_1 );
328         exception_type = PyExc_NameError;
329         Py_INCREF( exception_type );
330         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
331         exception_tb = NULL;
332         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
333         CHAIN_EXCEPTION( exception_value );
334  
335         exception_lineno = 32;
336         type_description_1 = "o";
337         goto frame_exception_exit_1;
338     }
339  
340     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
341     if ( tmp_res != 0 )
342     {
343         assert( ERROR_OCCURRED() );
344  
345         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
346         Py_DECREF( tmp_assign_source_1 );
347  
348         exception_lineno = 27;
349         type_description_1 = "o";
350         goto frame_exception_exit_1;
351     }
352     assert( var_l == NULL );
353     var_l = tmp_assign_source_1;
354 177
355 178
356 #if 0 179 #if 0
357     RESTORE_FRAME_EXCEPTION( frame_b8b1bbf70d7021b7960836dd920aa2df ); 180     RESTORE_FRAME_EXCEPTION( frame_b8b1bbf70d7021b7960836dd920aa2df );
358 #endif 181 #endif
379 202
380     // Attachs locals to frame if any. 203     // Attachs locals to frame if any.
381     Nuitka_Frame_AttachLocals( 204     Nuitka_Frame_AttachLocals(
382         (struct Nuitka_FrameObject *)frame_b8b1bbf70d7021b7960836dd920aa2df, 205         (struct Nuitka_FrameObject *)frame_b8b1bbf70d7021b7960836dd920aa2df,
383         type_description_1, 206         type_description_1,
n 384         var_l n 207         NULL
385     ); 208     );
386 209
387 210
388     // Release cached frame. 211     // Release cached frame.
389     if ( frame_b8b1bbf70d7021b7960836dd920aa2df == cache_frame_b8b1bbf70d7021b7960836dd920aa2df ) 212     if ( frame_b8b1bbf70d7021b7960836dd920aa2df == cache_frame_b8b1bbf70d7021b7960836dd920aa2df )
400     // Return the error. 223     // Return the error.
401     goto try_except_handler_1; 224     goto try_except_handler_1;
402 225
403     frame_no_exception_1:; 226     frame_no_exception_1:;
404 227
n 405     tmp_return_value = var_l; n
406  
407     CHECK_OBJECT( tmp_return_value );
408     Py_INCREF( tmp_return_value );
409     goto try_return_handler_1; 228     goto try_end_1;
410     // tried codes exits in all cases
411     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
412     return NULL;
413     // Return handler code:
414     try_return_handler_1:;
415     CHECK_OBJECT( (PyObject *)var_l );
416     Py_DECREF( var_l );
417     var_l = NULL;
418  
419     goto function_return_exit;
420     // Exception handler code: 229     // Exception handler code:
421     try_except_handler_1:; 230     try_except_handler_1:;
422     exception_keeper_type_1 = exception_type; 231     exception_keeper_type_1 = exception_type;
423     exception_keeper_value_1 = exception_value; 232     exception_keeper_value_1 = exception_value;
424     exception_keeper_tb_1 = exception_tb; 233     exception_keeper_tb_1 = exception_tb;
434     exception_tb = exception_keeper_tb_1; 243     exception_tb = exception_keeper_tb_1;
435     exception_lineno = exception_keeper_lineno_1; 244     exception_lineno = exception_keeper_lineno_1;
436 245
437     goto function_exception_exit; 246     goto function_exception_exit;
438     // 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;
439 252
440     // Return statement must have exited already. 253     // Return statement must have exited already.
441     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 254     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
442     return NULL; 255     return NULL;
443 256