Construct CallCompiledMethodPosArgsDefaulted

Performance Diagrams

Construct CallCompiledMethodPosArgsDefaulted 0.020000000.040000000.060000000.080000000.0100000000.0120000000.0140000000.0160000000.0180000000.0200000000.0220000000.0CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)23684498071.5384615385257.0114800226190.769230769384.337030006103550232310.0396.074862044114500137429.230769231384.650131886102649853548.461538462397.014284542Construct CallCompiledMethodPosArgsDefaulted236844980114800226103550232114500137102649853Ticks

Source Code with Construct

from __future__ import print_function

class C:
    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



for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

from __future__ import print_function

class C:
    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

for x in xrange(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 for x in xrange(50000): 39 for x in xrange(50000):
40     calledRepeatedly() 40     calledRepeatedly()
41 41
42 print("OK.") 42 print("OK.")

Context Diff of Generated Code


Construct
Baseline
382     PyObject *exception_keeper_value_1; 382     PyObject *exception_keeper_value_1;
383     PyTracebackObject *exception_keeper_tb_1; 383     PyTracebackObject *exception_keeper_tb_1;
384     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 384     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
385     PyObject *tmp_assign_source_1; 385     PyObject *tmp_assign_source_1;
386     PyObject *tmp_called_name_1; 386     PyObject *tmp_called_name_1;
n 387     PyObject *tmp_called_name_2; n
388     PyObject *tmp_called_name_3;
389     PyObject *tmp_called_name_4;
390     PyObject *tmp_frame_locals; 387     PyObject *tmp_frame_locals;
391     PyObject *tmp_return_value; 388     PyObject *tmp_return_value;
n 392     PyObject *tmp_source_name_1; n
393     PyObject *tmp_source_name_2;
394     PyObject *tmp_source_name_3;
395     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused;
396     static PyFrameObject *cache_frame_function = NULL; 389     static PyFrameObject *cache_frame_function = NULL;
397 390
398     PyFrameObject *frame_function; 391     PyFrameObject *frame_function;
399 392
400     tmp_return_value = NULL; 393     tmp_return_value = NULL;
448         goto frame_exception_exit_1; 441         goto frame_exception_exit_1;
449     } 442     }
450     assert( var_inst == NULL ); 443     assert( var_inst == NULL );
451     var_inst = tmp_assign_source_1; 444     var_inst = tmp_assign_source_1;
452 445
n 453     tmp_source_name_1 = var_inst; n
454  
455     tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_compiled_method );
456     if ( tmp_called_name_2 == NULL )
457     {
458         assert( ERROR_OCCURRED() );
459  
460         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
461  
462  
463         exception_lineno = 32;
464         goto frame_exception_exit_1;
465     }
466     frame_function->f_lineno = 32;
467     tmp_unused = CALL_FUNCTION_NO_ARGS( tmp_called_name_2 );
468     Py_DECREF( tmp_called_name_2 );
469     if ( tmp_unused == NULL )
470     {
471         assert( ERROR_OCCURRED() );
472  
473         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
474  
475  
476         exception_lineno = 32;
477         goto frame_exception_exit_1;
478     }
479     Py_DECREF( tmp_unused );
480     tmp_source_name_2 = var_inst;
481  
482     tmp_called_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_compiled_method );
483     if ( tmp_called_name_3 == NULL )
484     {
485         assert( ERROR_OCCURRED() );
486  
487         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
488  
489  
490         exception_lineno = 33;
491         goto frame_exception_exit_1;
492     }
493     frame_function->f_lineno = 33;
494     tmp_unused = CALL_FUNCTION_NO_ARGS( tmp_called_name_3 );
495     Py_DECREF( tmp_called_name_3 );
496     if ( tmp_unused == NULL )
497     {
498         assert( ERROR_OCCURRED() );
499  
500         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
501  
502  
503         exception_lineno = 33;
504         goto frame_exception_exit_1;
505     }
506     Py_DECREF( tmp_unused );
507     tmp_source_name_3 = var_inst;
508  
509     tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_compiled_method );
510     if ( tmp_called_name_4 == NULL )
511     {
512         assert( ERROR_OCCURRED() );
513  
514         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
515  
516  
517         exception_lineno = 34;
518         goto frame_exception_exit_1;
519     }
520     frame_function->f_lineno = 34;
521     tmp_unused = CALL_FUNCTION_NO_ARGS( tmp_called_name_4 );
522     Py_DECREF( tmp_called_name_4 );
523     if ( tmp_unused == NULL )
524     {
525         assert( ERROR_OCCURRED() );
526  
527         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
528  
529  
530         exception_lineno = 34;
531         goto frame_exception_exit_1;
532     }
533     Py_DECREF( tmp_unused );
534 446
535 #if 0 447 #if 0
536     RESTORE_FRAME_EXCEPTION( frame_function ); 448     RESTORE_FRAME_EXCEPTION( frame_function );
537 #endif 449 #endif
538     // Put the previous frame back on top. 450     // Put the previous frame back on top.
619     exception_keeper_lineno_1 = exception_lineno; 531     exception_keeper_lineno_1 = exception_lineno;
620     exception_type = NULL; 532     exception_type = NULL;
621     exception_value = NULL; 533     exception_value = NULL;
622     exception_tb = NULL; 534     exception_tb = NULL;
623     exception_lineno = -1; 535     exception_lineno = -1;
t 624   t
625     Py_XDECREF( var_inst );
626     var_inst = NULL;
627 536
628     // Re-raise. 537     // Re-raise.
629     exception_type = exception_keeper_type_1; 538     exception_type = exception_keeper_type_1;
630     exception_value = exception_keeper_value_1; 539     exception_value = exception_keeper_value_1;
631     exception_tb = exception_keeper_tb_1; 540     exception_tb = exception_keeper_tb_1;