Construct CallCompiledObjectMethodPosArgsDefaults

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsDefaults 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)22539528788.11538461538461257.0CPython 2.778451209240.03846153846155418.10426635461585Nuitka (master)78451247391.96153846153845418.1042246927659Nuitka (develop)78602015543.8846153846154417.93892801419037Nuitka (factory)Construct CallCompiledObjectMethodPosArgsDefaultsTicks Construct CallCompiledObjectMethodPosArgsDefaults 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)23150764088.11538461538461257.0CPython 3.580202785240.03846153846155418.5055012331343Nuitka (master)80202720391.96153846153845418.5055706152938Nuitka (develop)80352686543.8846153846154418.3454942317704Nuitka (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
337             goto frame_exception_exit_1; 337             goto frame_exception_exit_1;
338         } 338         }
339         assert(var_inst == NULL); 339         assert(var_inst == NULL);
340         var_inst = tmp_assign_source_1; 340         var_inst = tmp_assign_source_1;
341     } 341     }
n 342     { n
343         PyObject *tmp_called_instance_1;
344         PyObject *tmp_call_result_1;
345         CHECK_OBJECT(var_inst);
346         tmp_called_instance_1 = var_inst;
347         frame_c71680770ec2d2769e9056e4ba496ce4->m_frame.f_lineno = 32;
348         tmp_call_result_1 = CALL_METHOD_NO_ARGS(tmp_called_instance_1, const_str_plain_compiled_method);
349         if (tmp_call_result_1 == NULL) {
350             assert(ERROR_OCCURRED());
351  
352             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
353  
354  
355             exception_lineno = 32;
356             type_description_1 = "o";
357             goto frame_exception_exit_1;
358         }
359         Py_DECREF(tmp_call_result_1);
360     }
361     {
362         PyObject *tmp_called_instance_2;
363         PyObject *tmp_call_result_2;
364         CHECK_OBJECT(var_inst);
365         tmp_called_instance_2 = var_inst;
366         frame_c71680770ec2d2769e9056e4ba496ce4->m_frame.f_lineno = 33;
367         tmp_call_result_2 = CALL_METHOD_NO_ARGS(tmp_called_instance_2, const_str_plain_compiled_method);
368         if (tmp_call_result_2 == NULL) {
369             assert(ERROR_OCCURRED());
370  
371             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
372  
373  
374             exception_lineno = 33;
375             type_description_1 = "o";
376             goto frame_exception_exit_1;
377         }
378         Py_DECREF(tmp_call_result_2);
379     }
380     {
381         PyObject *tmp_called_instance_3;
382         PyObject *tmp_call_result_3;
383         CHECK_OBJECT(var_inst);
384         tmp_called_instance_3 = var_inst;
385         frame_c71680770ec2d2769e9056e4ba496ce4->m_frame.f_lineno = 34;
386         tmp_call_result_3 = CALL_METHOD_NO_ARGS(tmp_called_instance_3, const_str_plain_compiled_method);
387         if (tmp_call_result_3 == NULL) {
388             assert(ERROR_OCCURRED());
389  
390             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
391  
392  
393             exception_lineno = 34;
394             type_description_1 = "o";
395             goto frame_exception_exit_1;
396         }
397         Py_DECREF(tmp_call_result_3);
398     }
399 342
400 #if 0 343 #if 0
401     RESTORE_FRAME_EXCEPTION(frame_c71680770ec2d2769e9056e4ba496ce4); 344     RESTORE_FRAME_EXCEPTION(frame_c71680770ec2d2769e9056e4ba496ce4);
402 #endif 345 #endif
403 346
463     exception_keeper_lineno_1 = exception_lineno; 406     exception_keeper_lineno_1 = exception_lineno;
464     exception_type = NULL; 407     exception_type = NULL;
465     exception_value = NULL; 408     exception_value = NULL;
466     exception_tb = NULL; 409     exception_tb = NULL;
467     exception_lineno = 0; 410     exception_lineno = 0;
t 468   t
469     Py_XDECREF(var_inst);
470     var_inst = NULL;
471 411
472     // Re-raise. 412     // Re-raise.
473     exception_type = exception_keeper_type_1; 413     exception_type = exception_keeper_type_1;
474     exception_value = exception_keeper_value_1; 414     exception_value = exception_keeper_value_1;
475     exception_tb = exception_keeper_tb_1; 415     exception_tb = exception_keeper_tb_1;