Construct FunctionEmpty

Performance Diagrams

Construct FunctionEmpty 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000220000002200000024000000240000002600000026000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)2757822688.95192307692307257.0CPython 2.72750571242.31730769230768479.4688242972219Nuitka (master)2750586395.6826923076923479.46868988934636Nuitka (develop)2750567549.0480769230769479.4688601393221Nuitka (factory)Construct FunctionEmptyTicks Construct FunctionEmpty 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2891511388.95192307692307257.0CPython 3.55150209242.31730769230768460.10048217026485Nuitka (master)5147894395.6826923076923460.1202667070012Nuitka (develop)5147914549.0480769230769460.12009578227776Nuitka (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
165     PyObject *exception_keeper_type_1; 165     PyObject *exception_keeper_type_1;
166     PyObject *exception_keeper_value_1; 166     PyObject *exception_keeper_value_1;
167     PyTracebackObject *exception_keeper_tb_1; 167     PyTracebackObject *exception_keeper_tb_1;
168     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 168     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
169     PyObject *tmp_assign_source_1; 169     PyObject *tmp_assign_source_1;
n 170     PyObject *tmp_called_name_1; n
171     PyObject *tmp_return_value; 170     PyObject *tmp_return_value;
n 172     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
173     static struct Nuitka_FrameObject *cache_frame_b6699856379ac789393a481d36f77937 = NULL; 171     static struct Nuitka_FrameObject *cache_frame_b6699856379ac789393a481d36f77937 = NULL;
174 172
175     struct Nuitka_FrameObject *frame_b6699856379ac789393a481d36f77937; 173     struct Nuitka_FrameObject *frame_b6699856379ac789393a481d36f77937;
176 174
177     char const *type_description; 175     char const *type_description;
213 211
214     assert( var_called == NULL ); 212     assert( var_called == NULL );
215     Py_INCREF( tmp_assign_source_1 ); 213     Py_INCREF( tmp_assign_source_1 );
216     var_called = tmp_assign_source_1; 214     var_called = tmp_assign_source_1;
217 215
n 218     tmp_called_name_1 = var_called; n
219  
220     CHECK_OBJECT( tmp_called_name_1 );
221     frame_b6699856379ac789393a481d36f77937->m_frame.f_lineno = 34;
222     tmp_unused = CALL_FUNCTION_NO_ARGS( tmp_called_name_1 );
223     if ( tmp_unused == NULL )
224     {
225         assert( ERROR_OCCURRED() );
226  
227         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
228  
229  
230         exception_lineno = 34;
231         type_description = "o";
232         goto frame_exception_exit_1;
233     }
234     Py_DECREF( tmp_unused );
235 216
236 #if 0 217 #if 0
237     RESTORE_FRAME_EXCEPTION( frame_b6699856379ac789393a481d36f77937 ); 218     RESTORE_FRAME_EXCEPTION( frame_b6699856379ac789393a481d36f77937 );
238 #endif 219 #endif
239 220
283     // tried codes exits in all cases 264     // tried codes exits in all cases
284     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly ); 265     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly );
285     return NULL; 266     return NULL;
286     // Return handler code: 267     // Return handler code:
287     try_return_handler_1:; 268     try_return_handler_1:;
n n 269     CHECK_OBJECT( (PyObject *)var_called );
288     Py_XDECREF( var_called ); 270     Py_DECREF( var_called );
289     var_called = NULL; 271     var_called = NULL;
290 272
291     goto function_return_exit; 273     goto function_return_exit;
292     // Exception handler code: 274     // Exception handler code:
293     try_except_handler_1:; 275     try_except_handler_1:;
297     exception_keeper_lineno_1 = exception_lineno; 279     exception_keeper_lineno_1 = exception_lineno;
298     exception_type = NULL; 280     exception_type = NULL;
299     exception_value = NULL; 281     exception_value = NULL;
300     exception_tb = NULL; 282     exception_tb = NULL;
301     exception_lineno = 0; 283     exception_lineno = 0;
t 302   t
303     Py_XDECREF( var_called );
304     var_called = NULL;
305 284
306     // Re-raise. 285     // Re-raise.
307     exception_type = exception_keeper_type_1; 286     exception_type = exception_keeper_type_1;
308     exception_value = exception_keeper_value_1; 287     exception_value = exception_keeper_value_1;
309     exception_tb = exception_keeper_tb_1; 288     exception_tb = exception_keeper_tb_1;