Construct SetCreation

Performance Diagrams

Construct SetCreation 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)6372610588.95192307692307257.0CPython 2.746151781242.31730769230768325.1492433064187Nuitka (master)46151649395.6826923076923325.14975517248627Nuitka (develop)46151691549.0480769230769325.1495923060103Nuitka (factory)Construct SetCreationTicks Construct SetCreation 001000000010000000200000002000000030000000300000004000000040000000500000005000000060000000600000007000000070000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)7430009388.95192307692307257.0CPython 3.554151116242.31730769230768324.0136738720036Nuitka (master)54151654395.6826923076923324.01188453269657Nuitka (develop)54152190549.0480769230769324.0101018452085Nuitka (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
31 PyDictObject *moduledict___main__; 31 PyDictObject *moduledict___main__;
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;
n n 36 extern PyObject *const_int_pos_1;
36 extern PyObject *const_str_plain___file__; 37 extern PyObject *const_str_plain___file__;
37 static PyObject *const_str_digest_f51a608ffef23603939e59e0bb83283f; 38 static PyObject *const_str_digest_f51a608ffef23603939e59e0bb83283f;
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;
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_c5a260621ff267c1515351ac7de1a404; 123     struct Nuitka_FrameObject *frame_c5a260621ff267c1515351ac7de1a404;
124     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 124     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
125     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; 125     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
126     PyObject *exception_type = NULL; 126     PyObject *exception_type = NULL;
127     PyObject *exception_value = NULL; 127     PyObject *exception_value = NULL;
128     PyTracebackObject *exception_tb = NULL; 128     PyTracebackObject *exception_tb = NULL;
129     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 129     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 130     int tmp_res; n
131     static struct Nuitka_FrameObject *cache_frame_c5a260621ff267c1515351ac7de1a404 = NULL; 130     static struct Nuitka_FrameObject *cache_frame_c5a260621ff267c1515351ac7de1a404 = NULL;
n 132     PyObject *tmp_return_value = NULL; n
133     PyObject *exception_keeper_type_1; 131     PyObject *exception_keeper_type_1;
134     PyObject *exception_keeper_value_1; 132     PyObject *exception_keeper_value_1;
135     PyTracebackObject *exception_keeper_tb_1; 133     PyTracebackObject *exception_keeper_tb_1;
136     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 134     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
n n 135     PyObject *tmp_return_value = NULL;
137 136
138     // Actual function code. 137     // Actual function code.
139     { 138     {
140     // Tried code: 139     // Tried code:
141     MAKE_OR_REUSE_FRAME( cache_frame_c5a260621ff267c1515351ac7de1a404, codeobj_c5a260621ff267c1515351ac7de1a404, module___main__, sizeof(void *) ); 140     MAKE_OR_REUSE_FRAME( cache_frame_c5a260621ff267c1515351ac7de1a404, codeobj_c5a260621ff267c1515351ac7de1a404, module___main__, sizeof(void *) );
165         exception_tb = NULL; 164         exception_tb = NULL;
166         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 165         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
167         CHAIN_EXCEPTION( exception_value ); 166         CHAIN_EXCEPTION( exception_value );
168 167
169         exception_lineno = 24; 168         exception_lineno = 24;
n 170         type_description_1 = "o"; n 169         type_description_1 = "N";
171         goto frame_exception_exit_1; 170         goto frame_exception_exit_1;
172     } 171     }
n 173   n
174     }
175     {
176     PyObject *tmp_assign_source_1;
177     PyObject *tmp_set_element_1;
178     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
179  
180     if (unlikely( tmp_set_element_1 == NULL ))
181     {
182         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
183     }
184  
185     if ( tmp_set_element_1 == NULL )
186     {
187  
188         exception_type = PyExc_NameError;
189         Py_INCREF( exception_type );
190         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
191         exception_tb = NULL;
192         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
193         CHAIN_EXCEPTION( exception_value );
194  
195         exception_lineno = 28;
196         type_description_1 = "o";
197         goto frame_exception_exit_1;
198     }
199  
200     tmp_assign_source_1 = PySet_New( NULL );
201     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
202     if ( tmp_res != 0 )
203     {
204         assert( ERROR_OCCURRED() );
205  
206         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
207         Py_DECREF( tmp_assign_source_1 );
208  
209         exception_lineno = 27;
210         type_description_1 = "o";
211         goto frame_exception_exit_1;
212     }
213     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
214  
215     if (unlikely( tmp_set_element_1 == NULL ))
216     {
217         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
218     }
219  
220     if ( tmp_set_element_1 == NULL )
221     {
222         Py_DECREF( tmp_assign_source_1 );
223         exception_type = PyExc_NameError;
224         Py_INCREF( exception_type );
225         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
226         exception_tb = NULL;
227         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
228         CHAIN_EXCEPTION( exception_value );
229  
230         exception_lineno = 29;
231         type_description_1 = "o";
232         goto frame_exception_exit_1;
233     }
234  
235     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
236     if ( tmp_res != 0 )
237     {
238         assert( ERROR_OCCURRED() );
239  
240         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
241         Py_DECREF( tmp_assign_source_1 );
242  
243         exception_lineno = 27;
244         type_description_1 = "o";
245         goto frame_exception_exit_1;
246     }
247     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
248  
249     if (unlikely( tmp_set_element_1 == NULL ))
250     {
251         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
252     }
253  
254     if ( tmp_set_element_1 == NULL )
255     {
256         Py_DECREF( tmp_assign_source_1 );
257         exception_type = PyExc_NameError;
258         Py_INCREF( exception_type );
259         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
260         exception_tb = NULL;
261         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
262         CHAIN_EXCEPTION( exception_value );
263  
264         exception_lineno = 30;
265         type_description_1 = "o";
266         goto frame_exception_exit_1;
267     }
268  
269     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
270     if ( tmp_res != 0 )
271     {
272         assert( ERROR_OCCURRED() );
273  
274         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
275         Py_DECREF( tmp_assign_source_1 );
276  
277         exception_lineno = 27;
278         type_description_1 = "o";
279         goto frame_exception_exit_1;
280     }
281     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
282  
283     if (unlikely( tmp_set_element_1 == NULL ))
284     {
285         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
286     }
287  
288     if ( tmp_set_element_1 == NULL )
289     {
290         Py_DECREF( tmp_assign_source_1 );
291         exception_type = PyExc_NameError;
292         Py_INCREF( exception_type );
293         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
294         exception_tb = NULL;
295         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
296         CHAIN_EXCEPTION( exception_value );
297  
298         exception_lineno = 31;
299         type_description_1 = "o";
300         goto frame_exception_exit_1;
301     }
302  
303     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
304     if ( tmp_res != 0 )
305     {
306         assert( ERROR_OCCURRED() );
307  
308         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
309         Py_DECREF( tmp_assign_source_1 );
310  
311         exception_lineno = 27;
312         type_description_1 = "o";
313         goto frame_exception_exit_1;
314     }
315     tmp_set_element_1 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_module_value1 );
316  
317     if (unlikely( tmp_set_element_1 == NULL ))
318     {
319         tmp_set_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_module_value1 );
320     }
321  
322     if ( tmp_set_element_1 == NULL )
323     {
324         Py_DECREF( tmp_assign_source_1 );
325         exception_type = PyExc_NameError;
326         Py_INCREF( exception_type );
327         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "module_value1" );
328         exception_tb = NULL;
329         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
330         CHAIN_EXCEPTION( exception_value );
331  
332         exception_lineno = 32;
333         type_description_1 = "o";
334         goto frame_exception_exit_1;
335     }
336  
337     tmp_res = PySet_Add( tmp_assign_source_1, tmp_set_element_1 );
338     if ( tmp_res != 0 )
339     {
340         assert( ERROR_OCCURRED() );
341  
342         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
343         Py_DECREF( tmp_assign_source_1 );
344  
345         exception_lineno = 27;
346         type_description_1 = "o";
347         goto frame_exception_exit_1;
348     }
349     assert( var_l == NULL );
350     var_l = tmp_assign_source_1;
351 172
352     } 173     }
353 174
354 #if 0 175 #if 0
355     RESTORE_FRAME_EXCEPTION( frame_c5a260621ff267c1515351ac7de1a404 ); 176     RESTORE_FRAME_EXCEPTION( frame_c5a260621ff267c1515351ac7de1a404 );
377 198
378     // Attachs locals to frame if any. 199     // Attachs locals to frame if any.
379     Nuitka_Frame_AttachLocals( 200     Nuitka_Frame_AttachLocals(
380         (struct Nuitka_FrameObject *)frame_c5a260621ff267c1515351ac7de1a404, 201         (struct Nuitka_FrameObject *)frame_c5a260621ff267c1515351ac7de1a404,
381         type_description_1, 202         type_description_1,
n 382         var_l n 203         NULL
383     ); 204     );
384 205
385 206
386     // Release cached frame. 207     // Release cached frame.
387     if ( frame_c5a260621ff267c1515351ac7de1a404 == cache_frame_c5a260621ff267c1515351ac7de1a404 ) 208     if ( frame_c5a260621ff267c1515351ac7de1a404 == cache_frame_c5a260621ff267c1515351ac7de1a404 )
398     // Return the error. 219     // Return the error.
399     goto try_except_handler_1; 220     goto try_except_handler_1;
400 221
401     frame_no_exception_1:; 222     frame_no_exception_1:;
402 223
n 403     { n
404     tmp_return_value = var_l;
405  
406     CHECK_OBJECT( tmp_return_value );
407     Py_INCREF( tmp_return_value );
408     goto try_return_handler_1; 224     goto try_end_1;
409     }
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     {
416     CHECK_OBJECT( (PyObject *)var_l );
417     Py_DECREF( var_l );
418     var_l = NULL;
419  
420     }
421     {
422     goto function_return_exit;
423     }
424     // Exception handler code: 225     // Exception handler code:
425     try_except_handler_1:; 226     try_except_handler_1:;
426     exception_keeper_type_1 = exception_type; 227     exception_keeper_type_1 = exception_type;
427     exception_keeper_value_1 = exception_value; 228     exception_keeper_value_1 = exception_value;
428     exception_keeper_tb_1 = exception_tb; 229     exception_keeper_tb_1 = exception_tb;
440     exception_lineno = exception_keeper_lineno_1; 241     exception_lineno = exception_keeper_lineno_1;
441 242
442     goto function_exception_exit; 243     goto function_exception_exit;
443     } 244     }
444     // End of try: 245     // End of try:
t t 246     try_end_1:;
247     }
248     {
249     tmp_return_value = const_int_pos_1;
250     Py_INCREF( tmp_return_value );
251     goto function_return_exit;
445     } 252     }
446 253
447     // Return statement must have exited already. 254     // Return statement must have exited already.
448     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 255     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
449     return NULL; 256     return NULL;