Construct CallCompiledObjectMethodNoArgs

Performance Diagrams

Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)13233841788.11538461538461257.00000000000006CPython 2.729101233240.03846153846155449.77468333907325Nuitka (master)29101205391.96153846153845449.77473562344335Nuitka (develop)28951283543.8846153846154450.0546848138006Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks Construct CallCompiledObjectMethodNoArgs 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)12905780488.11538461538461257.0CPython 3.529952725240.03846153846155446.76295082801096Nuitka (master)29952712391.96153846153845446.76297571995786Nuitka (develop)29802542543.8846153846154447.05051600158Nuitka (factory)Construct CallCompiledObjectMethodNoArgsTicks

Source Code with Construct

from __future__ import print_function

class C(object):
    def compiled_method(self):
        return self

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):
        return self

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 32  
33     inst.compiled_method() 33  
34     inst.compiled_method() 34  
35 35
36 # construct_alternative 36 # construct_alternative
t 37   t 37     pass
38   38 # construct_end
39 39
40 import itertools 40 import itertools
41 for x in itertools.repeat(None, 50000): 41 for x in itertools.repeat(None, 50000):
42     calledRepeatedly() 42     calledRepeatedly()
43 43

Context Diff of Generated Code


Construct
Baseline
255             goto frame_exception_exit_1; 255             goto frame_exception_exit_1;
256         } 256         }
257         assert(var_inst == NULL); 257         assert(var_inst == NULL);
258         var_inst = tmp_assign_source_1; 258         var_inst = tmp_assign_source_1;
259     } 259     }
n 260     { n
261         PyObject *tmp_called_instance_1;
262         PyObject *tmp_call_result_1;
263         CHECK_OBJECT(var_inst);
264         tmp_called_instance_1 = var_inst;
265         frame_4bfd169a268f63733d012eda54f1c5a9->m_frame.f_lineno = 32;
266         tmp_call_result_1 = CALL_METHOD_NO_ARGS(tmp_called_instance_1, const_str_plain_compiled_method);
267         if (tmp_call_result_1 == NULL) {
268             assert(ERROR_OCCURRED());
269  
270             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
271  
272  
273             exception_lineno = 32;
274             type_description_1 = "o";
275             goto frame_exception_exit_1;
276         }
277         Py_DECREF(tmp_call_result_1);
278     }
279     {
280         PyObject *tmp_called_instance_2;
281         PyObject *tmp_call_result_2;
282         CHECK_OBJECT(var_inst);
283         tmp_called_instance_2 = var_inst;
284         frame_4bfd169a268f63733d012eda54f1c5a9->m_frame.f_lineno = 33;
285         tmp_call_result_2 = CALL_METHOD_NO_ARGS(tmp_called_instance_2, const_str_plain_compiled_method);
286         if (tmp_call_result_2 == NULL) {
287             assert(ERROR_OCCURRED());
288  
289             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
290  
291  
292             exception_lineno = 33;
293             type_description_1 = "o";
294             goto frame_exception_exit_1;
295         }
296         Py_DECREF(tmp_call_result_2);
297     }
298     {
299         PyObject *tmp_called_instance_3;
300         PyObject *tmp_call_result_3;
301         CHECK_OBJECT(var_inst);
302         tmp_called_instance_3 = var_inst;
303         frame_4bfd169a268f63733d012eda54f1c5a9->m_frame.f_lineno = 34;
304         tmp_call_result_3 = CALL_METHOD_NO_ARGS(tmp_called_instance_3, const_str_plain_compiled_method);
305         if (tmp_call_result_3 == NULL) {
306             assert(ERROR_OCCURRED());
307  
308             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
309  
310  
311             exception_lineno = 34;
312             type_description_1 = "o";
313             goto frame_exception_exit_1;
314         }
315         Py_DECREF(tmp_call_result_3);
316     }
317 260
318 #if 0 261 #if 0
319     RESTORE_FRAME_EXCEPTION(frame_4bfd169a268f63733d012eda54f1c5a9); 262     RESTORE_FRAME_EXCEPTION(frame_4bfd169a268f63733d012eda54f1c5a9);
320 #endif 263 #endif
321 264
381     exception_keeper_lineno_1 = exception_lineno; 324     exception_keeper_lineno_1 = exception_lineno;
382     exception_type = NULL; 325     exception_type = NULL;
383     exception_value = NULL; 326     exception_value = NULL;
384     exception_tb = NULL; 327     exception_tb = NULL;
385     exception_lineno = 0; 328     exception_lineno = 0;
t 386   t
387     Py_XDECREF(var_inst);
388     var_inst = NULL;
389 329
390     // Re-raise. 330     // Re-raise.
391     exception_type = exception_keeper_type_1; 331     exception_type = exception_keeper_type_1;
392     exception_value = exception_keeper_value_1; 332     exception_value = exception_keeper_value_1;
393     exception_tb = exception_keeper_tb_1; 333     exception_tb = exception_keeper_tb_1;