Construct SetCreation

Performance Diagrams

Construct SetCreation 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6372610588.95192307692307257.0CPython 2.746151198242.31730769230768325.15150404821725Nuitka (master)46151270395.6826923076923325.15122484854396Nuitka (develop)46150964549.0480769230769325.15241144715526Nuitka (factory)Construct SetCreationTicks Construct SetCreation 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)7430009388.95192307692307257.0CPython 3.554154684242.31730769230768324.00180702693376Nuitka (master)54142279395.6826923076923324.0430649341904Nuitka (develop)54153281549.0480769230769324.00647327795195Nuitka (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
32 32
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_digest_3e2aaaab9b971526f598718e9aa94a91; 36 static PyObject *const_str_digest_3e2aaaab9b971526f598718e9aa94a91;
n n 37 extern PyObject *const_int_pos_1;
37 extern PyObject *const_str_plain___file__; 38 extern PyObject *const_str_plain___file__;
38 extern PyObject *const_int_0; 39 extern PyObject *const_int_0;
39 extern PyObject *const_str_plain_print; 40 extern PyObject *const_str_plain_print;
40 static PyObject *const_int_pos_50000; 41 static PyObject *const_int_pos_50000;
41 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple; 42 static PyObject *const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple;
117 #ifndef __NUITKA_NO_ASSERT__ 118 #ifndef __NUITKA_NO_ASSERT__
118     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED(); 119     NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED();
119 #endif 120 #endif
120 121
121     // Local variable declarations. 122     // Local variable declarations.
n 122     PyObject *var_l = NULL; n
123     struct Nuitka_FrameObject *frame_e1bc2d5de338f6859dc08ac0c43f6a20; 123     struct Nuitka_FrameObject *frame_e1bc2d5de338f6859dc08ac0c43f6a20;
124     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 124     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
125     PyObject *exception_type = NULL; 125     PyObject *exception_type = NULL;
126     PyObject *exception_value = NULL; 126     PyObject *exception_value = NULL;
127     PyTracebackObject *exception_tb = NULL; 127     PyTracebackObject *exception_tb = NULL;
128     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 128     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 129     int tmp_res; n
130     static struct Nuitka_FrameObject *cache_frame_e1bc2d5de338f6859dc08ac0c43f6a20 = NULL; 129     static struct Nuitka_FrameObject *cache_frame_e1bc2d5de338f6859dc08ac0c43f6a20 = NULL;
131     PyObject *tmp_return_value = NULL; 130     PyObject *tmp_return_value = NULL;
n 132     PyObject *exception_keeper_type_1; n
133     PyObject *exception_keeper_value_1;
134     PyTracebackObject *exception_keeper_tb_1;
135     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
136 131
137     // Actual function code. 132     // Actual function code.
n 138     { n
139     // Tried code:
140     MAKE_OR_REUSE_FRAME( cache_frame_e1bc2d5de338f6859dc08ac0c43f6a20, codeobj_e1bc2d5de338f6859dc08ac0c43f6a20, module___main__, sizeof(void *) ); 133     MAKE_OR_REUSE_FRAME( cache_frame_e1bc2d5de338f6859dc08ac0c43f6a20, codeobj_e1bc2d5de338f6859dc08ac0c43f6a20, module___main__, sizeof(void *) );
141     frame_e1bc2d5de338f6859dc08ac0c43f6a20 = cache_frame_e1bc2d5de338f6859dc08ac0c43f6a20; 134     frame_e1bc2d5de338f6859dc08ac0c43f6a20 = cache_frame_e1bc2d5de338f6859dc08ac0c43f6a20;
142 135
143     // Push the new frame as the currently active one. 136     // Push the new frame as the currently active one.
144     pushFrameStack( frame_e1bc2d5de338f6859dc08ac0c43f6a20 ); 137     pushFrameStack( frame_e1bc2d5de338f6859dc08ac0c43f6a20 );
165         exception_tb = NULL; 158         exception_tb = NULL;
166         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 159         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
167         CHAIN_EXCEPTION( exception_value ); 160         CHAIN_EXCEPTION( exception_value );
168 161
169         exception_lineno = 24; 162         exception_lineno = 24;
n 170         type_description_1 = "o"; n 163         type_description_1 = "N";
171         goto frame_exception_exit_1; 164         goto frame_exception_exit_1;
172     } 165     }
n 173   n
174     }
175     {
176     PyObject *tmp_assign_source_1;
177     PyObject *tmp_set_element_1;
178     PyObject *tmp_mvar_value_2;
179     PyObject *tmp_mvar_value_3;
180     PyObject *tmp_mvar_value_4;
181     PyObject *tmp_mvar_value_5;
182     PyObject *tmp_mvar_value_6;
183     tmp_mvar_value_2 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
184  
185     if (unlikely( tmp_mvar_value_2 == NULL ))
186     {
187         tmp_mvar_value_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
188     }
189  
190     if ( tmp_mvar_value_2 == NULL )
191     {
192  
193         exception_type = PyExc_NameError;
194         Py_INCREF( exception_type );
195         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
196         exception_tb = NULL;
197         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
198         CHAIN_EXCEPTION( exception_value );
199  
200         exception_lineno = 28;
201         type_description_1 = "o";
202         goto frame_exception_exit_1;
203     }
204  
205     tmp_set_element_1 = tmp_mvar_value_2;
206     tmp_assign_source_1 = PySet_New( NULL );
207     assert( tmp_assign_source_1 );
208     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
209     if ( tmp_res != 0 )
210     {
211         assert( ERROR_OCCURRED() );
212  
213         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
214         Py_DECREF( tmp_assign_source_1 );
215  
216         exception_lineno = 27;
217         type_description_1 = "o";
218         goto frame_exception_exit_1;
219     }
220     tmp_mvar_value_3 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
221  
222     if (unlikely( tmp_mvar_value_3 == NULL ))
223     {
224         tmp_mvar_value_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
225     }
226  
227     if ( tmp_mvar_value_3 == NULL )
228     {
229         Py_DECREF( tmp_assign_source_1 );
230         exception_type = PyExc_NameError;
231         Py_INCREF( exception_type );
232         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
233         exception_tb = NULL;
234         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
235         CHAIN_EXCEPTION( exception_value );
236  
237         exception_lineno = 29;
238         type_description_1 = "o";
239         goto frame_exception_exit_1;
240     }
241  
242     tmp_set_element_1 = tmp_mvar_value_3;
243     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
244     if ( tmp_res != 0 )
245     {
246         assert( ERROR_OCCURRED() );
247  
248         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
249         Py_DECREF( tmp_assign_source_1 );
250  
251         exception_lineno = 27;
252         type_description_1 = "o";
253         goto frame_exception_exit_1;
254     }
255     tmp_mvar_value_4 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
256  
257     if (unlikely( tmp_mvar_value_4 == NULL ))
258     {
259         tmp_mvar_value_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
260     }
261  
262     if ( tmp_mvar_value_4 == NULL )
263     {
264         Py_DECREF( tmp_assign_source_1 );
265         exception_type = PyExc_NameError;
266         Py_INCREF( exception_type );
267         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
268         exception_tb = NULL;
269         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
270         CHAIN_EXCEPTION( exception_value );
271  
272         exception_lineno = 30;
273         type_description_1 = "o";
274         goto frame_exception_exit_1;
275     }
276  
277     tmp_set_element_1 = tmp_mvar_value_4;
278     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
279     if ( tmp_res != 0 )
280     {
281         assert( ERROR_OCCURRED() );
282  
283         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
284         Py_DECREF( tmp_assign_source_1 );
285  
286         exception_lineno = 27;
287         type_description_1 = "o";
288         goto frame_exception_exit_1;
289     }
290     tmp_mvar_value_5 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
291  
292     if (unlikely( tmp_mvar_value_5 == NULL ))
293     {
294         tmp_mvar_value_5 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
295     }
296  
297     if ( tmp_mvar_value_5 == NULL )
298     {
299         Py_DECREF( tmp_assign_source_1 );
300         exception_type = PyExc_NameError;
301         Py_INCREF( exception_type );
302         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
303         exception_tb = NULL;
304         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
305         CHAIN_EXCEPTION( exception_value );
306  
307         exception_lineno = 31;
308         type_description_1 = "o";
309         goto frame_exception_exit_1;
310     }
311  
312     tmp_set_element_1 = tmp_mvar_value_5;
313     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
314     if ( tmp_res != 0 )
315     {
316         assert( ERROR_OCCURRED() );
317  
318         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
319         Py_DECREF( tmp_assign_source_1 );
320  
321         exception_lineno = 27;
322         type_description_1 = "o";
323         goto frame_exception_exit_1;
324     }
325     tmp_mvar_value_6 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
326  
327     if (unlikely( tmp_mvar_value_6 == NULL ))
328     {
329         tmp_mvar_value_6 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
330     }
331  
332     if ( tmp_mvar_value_6 == NULL )
333     {
334         Py_DECREF( tmp_assign_source_1 );
335         exception_type = PyExc_NameError;
336         Py_INCREF( exception_type );
337         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
338         exception_tb = NULL;
339         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
340         CHAIN_EXCEPTION( exception_value );
341  
342         exception_lineno = 32;
343         type_description_1 = "o";
344         goto frame_exception_exit_1;
345     }
346  
347     tmp_set_element_1 = tmp_mvar_value_6;
348     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
349     if ( tmp_res != 0 )
350     {
351         assert( ERROR_OCCURRED() );
352  
353         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
354         Py_DECREF( tmp_assign_source_1 );
355  
356         exception_lineno = 27;
357         type_description_1 = "o";
358         goto frame_exception_exit_1;
359     }
360     assert( var_l == NULL );
361     var_l = tmp_assign_source_1;
362 166
363     } 167     }
364 168
365 #if 0 169 #if 0
366     RESTORE_FRAME_EXCEPTION( frame_e1bc2d5de338f6859dc08ac0c43f6a20 ); 170     RESTORE_FRAME_EXCEPTION( frame_e1bc2d5de338f6859dc08ac0c43f6a20 );
388 192
389     // Attachs locals to frame if any. 193     // Attachs locals to frame if any.
390     Nuitka_Frame_AttachLocals( 194     Nuitka_Frame_AttachLocals(
391         (struct Nuitka_FrameObject *)frame_e1bc2d5de338f6859dc08ac0c43f6a20, 195         (struct Nuitka_FrameObject *)frame_e1bc2d5de338f6859dc08ac0c43f6a20,
392         type_description_1, 196         type_description_1,
n 393         var_l n 197         NULL
394     ); 198     );
395 199
396 200
397     // Release cached frame. 201     // Release cached frame.
398     if ( frame_e1bc2d5de338f6859dc08ac0c43f6a20 == cache_frame_e1bc2d5de338f6859dc08ac0c43f6a20 ) 202     if ( frame_e1bc2d5de338f6859dc08ac0c43f6a20 == cache_frame_e1bc2d5de338f6859dc08ac0c43f6a20 )
405 209
406     // Put the previous frame back on top. 210     // Put the previous frame back on top.
407     popFrameStack(); 211     popFrameStack();
408 212
409     // Return the error. 213     // Return the error.
n 410     goto try_except_handler_1; n 214     goto function_exception_exit;
411 215
412     frame_no_exception_1:; 216     frame_no_exception_1:;
413     { 217     {
n 414     CHECK_OBJECT( var_l ); n 218     tmp_return_value = const_int_pos_1;
415     tmp_return_value = var_l;
416     Py_INCREF( tmp_return_value ); 219     Py_INCREF( tmp_return_value );
n 417     goto try_return_handler_1; n
418     }
419     // tried codes exits in all cases
420     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
421     return NULL;
422     // Return handler code:
423     try_return_handler_1:;
424     {
425     CHECK_OBJECT( (PyObject *)var_l );
426     Py_DECREF( var_l );
427     var_l = NULL;
428  
429     }
430     {
431     goto function_return_exit; 220     goto function_return_exit;
t 432     } t
433     // Exception handler code:
434     try_except_handler_1:;
435     exception_keeper_type_1 = exception_type;
436     exception_keeper_value_1 = exception_value;
437     exception_keeper_tb_1 = exception_tb;
438     exception_keeper_lineno_1 = exception_lineno;
439     exception_type = NULL;
440     exception_value = NULL;
441     exception_tb = NULL;
442     exception_lineno = 0;
443  
444     {
445     // Re-raise.
446     exception_type = exception_keeper_type_1;
447     exception_value = exception_keeper_value_1;
448     exception_tb = exception_keeper_tb_1;
449     exception_lineno = exception_keeper_lineno_1;
450  
451     goto function_exception_exit;
452     }
453     // End of try:
454     } 221     }
455 222
456     // Return statement must have exited already. 223     // Return statement must have exited already.
457     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 224     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
458     return NULL; 225     return NULL;