Construct FunctionEmpty

Performance Diagrams

Construct FunctionEmpty 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)2903608088.95192307692307257.0CPython 2.72949070242.31730769230768479.01693581280205Nuitka (master)2950564395.6826923076923479.00422092895354Nuitka (develop)2950060549.0480769230769479.0085102873603Nuitka (factory)Construct FunctionEmptyTicks Construct FunctionEmpty 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2941511488.95192307692307257.0CPython 3.55347942242.31730769230768459.18750351892623Nuitka (master)5347042395.6826923076923459.1950643886938Nuitka (develop)5347744549.0480769230769459.1891669102751Nuitka (factory)Construct FunctionEmptyTicks

Source Code with Construct

def empty():
    pass

module_var = None

def calledRepeatedly():
    # We measure making that call or not. Lets get the module
    # variable look-up out of the game, by making it a local
    # variable
    called = empty

# construct_begin
    called()
# construct_end

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

print("OK.")

Source Code without Construct

def empty():
    pass

module_var = None

def calledRepeatedly():
    # We measure making that call or not. Lets get the module
    # variable look-up out of the game, by making it a local
    # variable
    called = empty

# construct_begin



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

print("OK.")

Context Diff of Source Code


Construct
Baseline
29     # variable look-up out of the game, by making it a local 29     # variable look-up out of the game, by making it a local
30     # variable 30     # variable
31     called = empty 31     called = empty
32 32
33 # construct_begin 33 # construct_begin
t 34     called() t 34  
35 # construct_end 35  
36 36
37 import itertools 37 import itertools
38 for x in itertools.repeat(None, 50000): 38 for x in itertools.repeat(None, 50000):
39     calledRepeatedly() 39     calledRepeatedly()
40 40

Context Diff of Generated Code


Construct
Baseline
159     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 159     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
160     PyObject *exception_type = NULL; 160     PyObject *exception_type = NULL;
161     PyObject *exception_value = NULL; 161     PyObject *exception_value = NULL;
162     PyTracebackObject *exception_tb = NULL; 162     PyTracebackObject *exception_tb = NULL;
163     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 163     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 164     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
165     static struct Nuitka_FrameObject *cache_frame_90923df0668ce43815a539816aca877f = NULL; 164     static struct Nuitka_FrameObject *cache_frame_90923df0668ce43815a539816aca877f = NULL;
166     PyObject *tmp_return_value = NULL; 165     PyObject *tmp_return_value = NULL;
167     PyObject *exception_keeper_type_1; 166     PyObject *exception_keeper_type_1;
168     PyObject *exception_keeper_value_1; 167     PyObject *exception_keeper_value_1;
169     PyTracebackObject *exception_keeper_tb_1; 168     PyTracebackObject *exception_keeper_tb_1;
209     assert( var_called == NULL ); 208     assert( var_called == NULL );
210     Py_INCREF( tmp_assign_source_1 ); 209     Py_INCREF( tmp_assign_source_1 );
211     var_called = tmp_assign_source_1; 210     var_called = tmp_assign_source_1;
212 211
213     } 212     }
n 214     { n
215     PyObject *tmp_called_name_1;
216     tmp_called_name_1 = var_called;
217  
218     CHECK_OBJECT( tmp_called_name_1 );
219     frame_90923df0668ce43815a539816aca877f->m_frame.f_lineno = 34;
220     tmp_unused = CALL_FUNCTION_NO_ARGS( tmp_called_name_1 );
221     if ( tmp_unused == NULL )
222     {
223         assert( ERROR_OCCURRED() );
224  
225         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
226  
227  
228         exception_lineno = 34;
229         type_description_1 = "o";
230         goto frame_exception_exit_1;
231     }
232     Py_DECREF( tmp_unused );
233     }
234 213
235 #if 0 214 #if 0
236     RESTORE_FRAME_EXCEPTION( frame_90923df0668ce43815a539816aca877f ); 215     RESTORE_FRAME_EXCEPTION( frame_90923df0668ce43815a539816aca877f );
237 #endif 216 #endif
238 217
290     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly ); 269     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly );
291     return NULL; 270     return NULL;
292     // Return handler code: 271     // Return handler code:
293     try_return_handler_1:; 272     try_return_handler_1:;
294     { 273     {
n n 274     CHECK_OBJECT( (PyObject *)var_called );
295     Py_XDECREF( var_called ); 275     Py_DECREF( var_called );
296     var_called = NULL; 276     var_called = NULL;
297 277
298     } 278     }
299     { 279     {
300     goto function_return_exit; 280     goto function_return_exit;
308     exception_type = NULL; 288     exception_type = NULL;
309     exception_value = NULL; 289     exception_value = NULL;
310     exception_tb = NULL; 290     exception_tb = NULL;
311     exception_lineno = 0; 291     exception_lineno = 0;
312 292
t 313     { t
314     Py_XDECREF( var_called );
315     var_called = NULL;
316  
317     }
318     { 293     {
319     // Re-raise. 294     // Re-raise.
320     exception_type = exception_keeper_type_1; 295     exception_type = exception_keeper_type_1;
321     exception_value = exception_keeper_value_1; 296     exception_value = exception_keeper_value_1;
322     exception_tb = exception_keeper_tb_1; 297     exception_tb = exception_keeper_tb_1;