Construct SetCreation

Performance Diagrams

Construct SetCreation 0010000000100000002000000020000000300000003000000040000000400000005000000050000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)5594141988.95192307692307257.0CPython 2.745352556242.31730769230768303.7751980493133Nuitka (master)45352560395.6826923076923303.7751803797304Nuitka (develop)45351977549.0480769230769303.77775572143264Nuitka (factory)Construct SetCreationTicks Construct SetCreation 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)7295868888.95192307692307257.00000000000006CPython 3.553400380242.31730769230768323.24514415399244Nuitka (master)53424032395.6826923076923323.16503343329356Nuitka (develop)53422936549.0480769230769323.1687456500146Nuitka (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_76988a741dd969dd4e5ded85bcfc351b = NULL; 137     static struct Nuitka_FrameObject *cache_frame_76988a741dd969dd4e5ded85bcfc351b = NULL;
145 138
146     struct Nuitka_FrameObject *frame_76988a741dd969dd4e5ded85bcfc351b; 139     struct Nuitka_FrameObject *frame_76988a741dd969dd4e5ded85bcfc351b;
147 140
148     char const *type_description; 141     char const *type_description;
149     tmp_return_value = NULL; 142     tmp_return_value = NULL;
150 143
151     // Actual function code. 144     // Actual function code.
152     // Tried code: 145     // Tried code:
n 153     MAKE_OR_REUSE_FRAME( cache_frame_76988a741dd969dd4e5ded85bcfc351b, codeobj_76988a741dd969dd4e5ded85bcfc351b, module___main__, sizeof(PyObject *) ); n 146     MAKE_OR_REUSE_FRAME( cache_frame_76988a741dd969dd4e5ded85bcfc351b, codeobj_76988a741dd969dd4e5ded85bcfc351b, module___main__, sizeof(void *) );
154     frame_76988a741dd969dd4e5ded85bcfc351b = cache_frame_76988a741dd969dd4e5ded85bcfc351b; 147     frame_76988a741dd969dd4e5ded85bcfc351b = cache_frame_76988a741dd969dd4e5ded85bcfc351b;
155 148
156     // Push the new frame as the currently active one. 149     // Push the new frame as the currently active one.
157     pushFrameStack( frame_76988a741dd969dd4e5ded85bcfc351b ); 150     pushFrameStack( frame_76988a741dd969dd4e5ded85bcfc351b );
158 151
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 = "o"; n 174         type_description = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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_76988a741dd969dd4e5ded85bcfc351b ); 180     RESTORE_FRAME_EXCEPTION( frame_76988a741dd969dd4e5ded85bcfc351b );
362 #endif 181 #endif
379     else if ( exception_tb->tb_frame != &frame_76988a741dd969dd4e5ded85bcfc351b->m_frame ) 198     else if ( exception_tb->tb_frame != &frame_76988a741dd969dd4e5ded85bcfc351b->m_frame )
380     { 199     {
381         exception_tb = ADD_TRACEBACK( exception_tb, frame_76988a741dd969dd4e5ded85bcfc351b, exception_lineno ); 200         exception_tb = ADD_TRACEBACK( exception_tb, frame_76988a741dd969dd4e5ded85bcfc351b, exception_lineno );
382     } 201     }
383 202
n 384     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_76988a741dd969dd4e5ded85bcfc351b, type_description ,var_l ); n 203     Nuitka_Frame_AttachLocals( (struct Nuitka_FrameObject *)frame_76988a741dd969dd4e5ded85bcfc351b, type_description ,NULL );
385 204
386     // Release cached frame. 205     // Release cached frame.
387     if ( frame_76988a741dd969dd4e5ded85bcfc351b == cache_frame_76988a741dd969dd4e5ded85bcfc351b ) 206     if ( frame_76988a741dd969dd4e5ded85bcfc351b == cache_frame_76988a741dd969dd4e5ded85bcfc351b )
388     { 207     {
389         Py_DECREF( frame_76988a741dd969dd4e5ded85bcfc351b ); 208         Py_DECREF( frame_76988a741dd969dd4e5ded85bcfc351b );
399     // Return the error. 218     // Return the error.
400     goto try_except_handler_1; 219     goto try_except_handler_1;
401 220
402     frame_no_exception_1:; 221     frame_no_exception_1:;
403 222
n 404     tmp_return_value = var_l; n
405  
406     CHECK_OBJECT( tmp_return_value );
407     Py_INCREF( tmp_return_value );
408     goto try_return_handler_1; 223     goto try_end_1;
409     // tried codes exits in all cases
410     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
411     return NULL;
412     // Return handler code:
413     try_return_handler_1:;
414     CHECK_OBJECT( (PyObject *)var_l );
415     Py_DECREF( var_l );
416     var_l = NULL;
417  
418     goto function_return_exit;
419     // Exception handler code: 224     // Exception handler code:
420     try_except_handler_1:; 225     try_except_handler_1:;
421     exception_keeper_type_1 = exception_type; 226     exception_keeper_type_1 = exception_type;
422     exception_keeper_value_1 = exception_value; 227     exception_keeper_value_1 = exception_value;
423     exception_keeper_tb_1 = exception_tb; 228     exception_keeper_tb_1 = exception_tb;
433     exception_tb = exception_keeper_tb_1; 238     exception_tb = exception_keeper_tb_1;
434     exception_lineno = exception_keeper_lineno_1; 239     exception_lineno = exception_keeper_lineno_1;
435 240
436     goto function_exception_exit; 241     goto function_exception_exit;
437     // End of try: 242     // End of try:
t t 243     try_end_1:;
244     tmp_return_value = const_int_pos_1;
245     Py_INCREF( tmp_return_value );
246     goto function_return_exit;
438 247
439     // Return statement must have exited already. 248     // Return statement must have exited already.
440     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 249     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
441     return NULL; 250     return NULL;
442 251