Construct CallCompiledObjectMethodPosArgsDefaults

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsDefaults 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000240000000240000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)24202407088.11538461538461257.0CPython 2.780201150240.03846153846155422.22709131940724Nuitka (master)80201142391.96153846153845422.22709948769847Nuitka (develop)80201114543.8846153846154422.2271280767176Nuitka (factory)Construct CallCompiledObjectMethodPosArgsDefaultsTicks Construct CallCompiledObjectMethodPosArgsDefaults 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)23660636688.11538461538461257.0CPython 3.580597991240.03846153846155419.93758381524765Nuitka (master)80602165391.96153846153845419.9332244244467Nuitka (develop)80605505543.8846153846154419.92973607627346Nuitka (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
315     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 315     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
316     PyObject *exception_type = NULL; 316     PyObject *exception_type = NULL;
317     PyObject *exception_value = NULL; 317     PyObject *exception_value = NULL;
318     PyTracebackObject *exception_tb = NULL; 318     PyTracebackObject *exception_tb = NULL;
319     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 319     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 320     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
321     static struct Nuitka_FrameObject *cache_frame_2a771fa724384b05d363aa28564e6d43 = NULL; 320     static struct Nuitka_FrameObject *cache_frame_2a771fa724384b05d363aa28564e6d43 = NULL;
322     PyObject *tmp_return_value = NULL; 321     PyObject *tmp_return_value = NULL;
323     PyObject *exception_keeper_type_1; 322     PyObject *exception_keeper_type_1;
324     PyObject *exception_keeper_value_1; 323     PyObject *exception_keeper_value_1;
325     PyTracebackObject *exception_keeper_tb_1; 324     PyTracebackObject *exception_keeper_tb_1;
378     } 377     }
379     assert( var_inst == NULL ); 378     assert( var_inst == NULL );
380     var_inst = tmp_assign_source_1; 379     var_inst = tmp_assign_source_1;
381 380
382     } 381     }
n 383     { n
384     PyObject *tmp_called_instance_1;
385     tmp_called_instance_1 = var_inst;
386  
387     CHECK_OBJECT( tmp_called_instance_1 );
388     frame_2a771fa724384b05d363aa28564e6d43->m_frame.f_lineno = 32;
389     tmp_unused = CALL_METHOD_NO_ARGS( tmp_called_instance_1, const_str_plain_compiled_method );
390     if ( tmp_unused == NULL )
391     {
392         assert( ERROR_OCCURRED() );
393  
394         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
395  
396  
397         exception_lineno = 32;
398         type_description_1 = "o";
399         goto frame_exception_exit_1;
400     }
401     Py_DECREF( tmp_unused );
402     }
403     {
404     PyObject *tmp_called_instance_2;
405     tmp_called_instance_2 = var_inst;
406  
407     if ( tmp_called_instance_2 == NULL )
408     {
409  
410         exception_type = PyExc_UnboundLocalError;
411         Py_INCREF( exception_type );
412         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inst" );
413         exception_tb = NULL;
414         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
415         CHAIN_EXCEPTION( exception_value );
416  
417         exception_lineno = 33;
418         type_description_1 = "o";
419         goto frame_exception_exit_1;
420     }
421  
422     frame_2a771fa724384b05d363aa28564e6d43->m_frame.f_lineno = 33;
423     tmp_unused = CALL_METHOD_NO_ARGS( tmp_called_instance_2, const_str_plain_compiled_method );
424     if ( tmp_unused == NULL )
425     {
426         assert( ERROR_OCCURRED() );
427  
428         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
429  
430  
431         exception_lineno = 33;
432         type_description_1 = "o";
433         goto frame_exception_exit_1;
434     }
435     Py_DECREF( tmp_unused );
436     }
437     {
438     PyObject *tmp_called_instance_3;
439     tmp_called_instance_3 = var_inst;
440  
441     if ( tmp_called_instance_3 == NULL )
442     {
443  
444         exception_type = PyExc_UnboundLocalError;
445         Py_INCREF( exception_type );
446         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inst" );
447         exception_tb = NULL;
448         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
449         CHAIN_EXCEPTION( exception_value );
450  
451         exception_lineno = 34;
452         type_description_1 = "o";
453         goto frame_exception_exit_1;
454     }
455  
456     frame_2a771fa724384b05d363aa28564e6d43->m_frame.f_lineno = 34;
457     tmp_unused = CALL_METHOD_NO_ARGS( tmp_called_instance_3, const_str_plain_compiled_method );
458     if ( tmp_unused == NULL )
459     {
460         assert( ERROR_OCCURRED() );
461  
462         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
463  
464  
465         exception_lineno = 34;
466         type_description_1 = "o";
467         goto frame_exception_exit_1;
468     }
469     Py_DECREF( tmp_unused );
470     }
471 382
472 #if 0 383 #if 0
473     RESTORE_FRAME_EXCEPTION( frame_2a771fa724384b05d363aa28564e6d43 ); 384     RESTORE_FRAME_EXCEPTION( frame_2a771fa724384b05d363aa28564e6d43 );
474 #endif 385 #endif
475 386
527     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly ); 438     NUITKA_CANNOT_GET_HERE( __main__$$$function_2_calledRepeatedly );
528     return NULL; 439     return NULL;
529     // Return handler code: 440     // Return handler code:
530     try_return_handler_1:; 441     try_return_handler_1:;
531     { 442     {
n n 443     CHECK_OBJECT( (PyObject *)var_inst );
532     Py_XDECREF( var_inst ); 444     Py_DECREF( var_inst );
533     var_inst = NULL; 445     var_inst = NULL;
534 446
535     } 447     }
536     { 448     {
537     goto function_return_exit; 449     goto function_return_exit;
545     exception_type = NULL; 457     exception_type = NULL;
546     exception_value = NULL; 458     exception_value = NULL;
547     exception_tb = NULL; 459     exception_tb = NULL;
548     exception_lineno = 0; 460     exception_lineno = 0;
549 461
t 550     { t
551     Py_XDECREF( var_inst );
552     var_inst = NULL;
553  
554     }
555     { 462     {
556     // Re-raise. 463     // Re-raise.
557     exception_type = exception_keeper_type_1; 464     exception_type = exception_keeper_type_1;
558     exception_value = exception_keeper_value_1; 465     exception_value = exception_keeper_value_1;
559     exception_tb = exception_keeper_tb_1; 466     exception_tb = exception_keeper_tb_1;