Construct CallCompiledObjectMethodPosArgsDefaults

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsDefaults 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000240000000240000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)24067681488.11538461538461257.0CPython 2.780201302240.03846153846155421.76854255362866Nuitka (master)80201294391.96153846153845421.7685507676442Nuitka (develop)80201284543.8846153846154421.76856103516354Nuitka (factory)Construct CallCompiledObjectMethodPosArgsDefaultsTicks Construct CallCompiledObjectMethodPosArgsDefaults 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)23810627088.11538461538461257.0CPython 3.580147501240.03846153846155420.93538042827555Nuitka (master)80152387391.96153846153845420.93030955899843Nuitka (develop)80151531543.8846153846154420.9311979470666Nuitka (factory)Construct CallCompiledObjectMethodPosArgsDefaultsTicks

Source Code with Construct

from __future__ import print_function

class C(object):
    def compiled_method(self, a = 1, b = 2,c = 3,d = 4,e = 5,f = 6):
        return a, b, c, d, e, f

def calledRepeatedly():
    inst = C()

    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
# construct_begin
    inst.compiled_method()
    inst.compiled_method()
    inst.compiled_method()
# construct_alternative



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

print("OK.")

Source Code without Construct

from __future__ import print_function

class C(object):
    def compiled_method(self, a = 1, b = 2,c = 3,d = 4,e = 5,f = 6):
        return a, b, c, d, e, f

def calledRepeatedly():
    inst = C()

    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
# construct_begin



# construct_alternative
    pass
# construct_end

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

print("OK.")

Context Diff of Source Code


Construct
Baseline
27     inst = C() 27     inst = C()
28 28
29     # This is supposed to make a call to a non-compiled function, which is 29     # This is supposed to make a call to a non-compiled function, which is
30     # being optimized separately. 30     # being optimized separately.
31 # construct_begin 31 # construct_begin
n 32     inst.compiled_method() n
33     inst.compiled_method()
34     inst.compiled_method()
35 # construct_alternative
36 32
37 33
t t 34  
35 # construct_alternative
36     pass
37 # construct_end
38 38
39 import itertools 39 import itertools
40 for x in itertools.repeat(None, 50000): 40 for x in itertools.repeat(None, 50000):
41     calledRepeatedly() 41     calledRepeatedly()
42 42

Context Diff of Generated Code


Construct
Baseline
365             goto frame_exception_exit_1; 365             goto frame_exception_exit_1;
366         } 366         }
367         assert( var_inst == NULL ); 367         assert( var_inst == NULL );
368         var_inst = tmp_assign_source_1; 368         var_inst = tmp_assign_source_1;
369     } 369     }
n 370     { n
371         PyObject *tmp_called_instance_1;
372         PyObject *tmp_call_result_1;
373         CHECK_OBJECT( var_inst );
374         tmp_called_instance_1 = var_inst;
375         frame_1fb8c9f58052edf590849b442e27cbca->m_frame.f_lineno = 32;
376         tmp_call_result_1 = CALL_METHOD_NO_ARGS( tmp_called_instance_1, const_str_plain_compiled_method );
377         if ( tmp_call_result_1 == NULL )
378         {
379             assert( ERROR_OCCURRED() );
380  
381             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
382  
383  
384             exception_lineno = 32;
385             type_description_1 = "o";
386             goto frame_exception_exit_1;
387         }
388         Py_DECREF( tmp_call_result_1 );
389     }
390     {
391         PyObject *tmp_called_instance_2;
392         PyObject *tmp_call_result_2;
393         CHECK_OBJECT( var_inst );
394         tmp_called_instance_2 = var_inst;
395         frame_1fb8c9f58052edf590849b442e27cbca->m_frame.f_lineno = 33;
396         tmp_call_result_2 = CALL_METHOD_NO_ARGS( tmp_called_instance_2, const_str_plain_compiled_method );
397         if ( tmp_call_result_2 == NULL )
398         {
399             assert( ERROR_OCCURRED() );
400  
401             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
402  
403  
404             exception_lineno = 33;
405             type_description_1 = "o";
406             goto frame_exception_exit_1;
407         }
408         Py_DECREF( tmp_call_result_2 );
409     }
410     {
411         PyObject *tmp_called_instance_3;
412         PyObject *tmp_call_result_3;
413         CHECK_OBJECT( var_inst );
414         tmp_called_instance_3 = var_inst;
415         frame_1fb8c9f58052edf590849b442e27cbca->m_frame.f_lineno = 34;
416         tmp_call_result_3 = CALL_METHOD_NO_ARGS( tmp_called_instance_3, const_str_plain_compiled_method );
417         if ( tmp_call_result_3 == NULL )
418         {
419             assert( ERROR_OCCURRED() );
420  
421             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
422  
423  
424             exception_lineno = 34;
425             type_description_1 = "o";
426             goto frame_exception_exit_1;
427         }
428         Py_DECREF( tmp_call_result_3 );
429     }
430 370
431 #if 0 371 #if 0
432     RESTORE_FRAME_EXCEPTION( frame_1fb8c9f58052edf590849b442e27cbca ); 372     RESTORE_FRAME_EXCEPTION( frame_1fb8c9f58052edf590849b442e27cbca );
433 #endif 373 #endif
434 374
497     exception_keeper_lineno_1 = exception_lineno; 437     exception_keeper_lineno_1 = exception_lineno;
498     exception_type = NULL; 438     exception_type = NULL;
499     exception_value = NULL; 439     exception_value = NULL;
500     exception_tb = NULL; 440     exception_tb = NULL;
501     exception_lineno = 0; 441     exception_lineno = 0;
t 502   t
503     Py_XDECREF( var_inst );
504     var_inst = NULL;
505 442
506     // Re-raise. 443     // Re-raise.
507     exception_type = exception_keeper_type_1; 444     exception_type = exception_keeper_type_1;
508     exception_value = exception_keeper_value_1; 445     exception_value = exception_keeper_value_1;
509     exception_tb = exception_keeper_tb_1; 446     exception_tb = exception_keeper_tb_1;