Construct CallCompiledObjectMethodPosArgsDefaults

Performance Diagrams

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