Construct CallCompiledObjectMethodPosArgsDefaults

Performance Diagrams

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