Construct CallCompiledObjectMethodPosArgsConstant1

Performance Diagrams

Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)14774100772.9230769230769257.0CPython 2.754251813194.46153846153845413.37241549796875Nuitka (historic)38253250316.0440.1320209001335Nuitka (master)38252540437.53846153846143440.1332084642813Nuitka (develop)38253190559.0769230769231440.1321212576671Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks Construct CallCompiledObjectMethodPosArgsConstant1 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)14124162972.9230769230769257.0CPython 3.50194.46153846153845504.11538461538464Nuitka (historic)36301013316.0440.60338144085966Nuitka (master)36298800437.53846153846143440.60725329046966Nuitka (develop)36310532559.0769230769231440.58672706379815Nuitka (factory)Construct CallCompiledObjectMethodPosArgsConstant1Ticks

Source Code with Construct

from __future__ import print_function

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

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("some")
    inst.compiled_method("some")
    inst.compiled_method("some")

# construct_alternative



for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

from __future__ import print_function

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

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("some") n 32  
33     inst.compiled_method("some") 33  
34     inst.compiled_method("some") 34  
35 35
36 # construct_alternative 36 # construct_alternative
t 37   t 37     pass
38   38 # construct_end
39 39
40 for x in xrange(50000): 40 for x in xrange(50000):
41     calledRepeatedly() 41     calledRepeatedly()
42 42
43 print("OK.") 43 print("OK.")

Context Diff of Generated Code


Construct
Baseline
57 static PyObject *const_str_plain_x; 57 static PyObject *const_str_plain_x;
58 static PyObject *const_str_plain_C; 58 static PyObject *const_str_plain_C;
59 extern PyObject *const_tuple_empty; 59 extern PyObject *const_tuple_empty;
60 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352; 60 static PyObject *const_str_digest_5ed1392909ad16e6227b8230f4582352;
61 static PyObject *const_tuple_str_plain_inst_tuple; 61 static PyObject *const_tuple_str_plain_inst_tuple;
n 62 static PyObject *const_str_plain_some; n
63 extern PyObject *const_str_plain___loader__; 62 extern PyObject *const_str_plain___loader__;
64 extern PyObject *const_str_plain___main__; 63 extern PyObject *const_str_plain___main__;
65 extern PyObject *const_str_plain_type; 64 extern PyObject *const_str_plain_type;
n 66 static PyObject *const_tuple_str_plain_some_tuple; n
67 extern PyObject *const_str_plain___doc__; 65 extern PyObject *const_str_plain___doc__;
68 extern PyObject *const_str_plain___cached__; 66 extern PyObject *const_str_plain___cached__;
69 extern PyObject *const_str_plain___class__; 67 extern PyObject *const_str_plain___class__;
70 static PyObject *module_filename_obj; 68 static PyObject *module_filename_obj;
71 69
96     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 206 ], 8, 0 ); 94     const_str_angle_module = UNSTREAM_STRING( &constant_bin[ 206 ], 8, 0 );
97     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 60 ], 1, 1 ); 95     const_str_plain_x = UNSTREAM_STRING( &constant_bin[ 60 ], 1, 1 );
98     const_str_plain_C = UNSTREAM_STRING( &constant_bin[ 90 ], 1, 1 ); 96     const_str_plain_C = UNSTREAM_STRING( &constant_bin[ 90 ], 1, 1 );
99     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 ); 97     const_tuple_str_plain_inst_tuple = PyTuple_New( 1 );
100     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst ); 98     PyTuple_SET_ITEM( const_tuple_str_plain_inst_tuple, 0, const_str_plain_inst ); Py_INCREF( const_str_plain_inst );
n 101     const_str_plain_some = UNSTREAM_STRING( &constant_bin[ 214 ], 4, 1 ); n
102     const_tuple_str_plain_some_tuple = PyTuple_New( 1 );
103     PyTuple_SET_ITEM( const_tuple_str_plain_some_tuple, 0, const_str_plain_some ); Py_INCREF( const_str_plain_some );
104 99
105     constants_created = true; 100     constants_created = true;
106 } 101 }
107 102
108 #ifndef __NUITKA_NO_ASSERT__ 103 #ifndef __NUITKA_NO_ASSERT__
410     PyObject *exception_keeper_type_1; 405     PyObject *exception_keeper_type_1;
411     PyObject *exception_keeper_value_1; 406     PyObject *exception_keeper_value_1;
412     PyTracebackObject *exception_keeper_tb_1; 407     PyTracebackObject *exception_keeper_tb_1;
413     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 408     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
414     PyObject *tmp_assign_source_1; 409     PyObject *tmp_assign_source_1;
n 415     PyObject *tmp_called_instance_1; n
416     PyObject *tmp_called_instance_2;
417     PyObject *tmp_called_instance_3;
418     PyObject *tmp_called_name_1; 410     PyObject *tmp_called_name_1;
419     PyObject *tmp_frame_locals; 411     PyObject *tmp_frame_locals;
420     PyObject *tmp_return_value; 412     PyObject *tmp_return_value;
n 421     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
422     static PyFrameObject *cache_frame_function = NULL; 413     static PyFrameObject *cache_frame_function = NULL;
423 414
424     PyFrameObject *frame_function; 415     PyFrameObject *frame_function;
425 416
426     tmp_return_value = NULL; 417     tmp_return_value = NULL;
476         goto frame_exception_exit_1; 467         goto frame_exception_exit_1;
477     } 468     }
478     assert( var_inst == NULL ); 469     assert( var_inst == NULL );
479     var_inst = tmp_assign_source_1; 470     var_inst = tmp_assign_source_1;
480 471
n 481     tmp_called_instance_1 = var_inst; n
482  
483     frame_function->f_lineno = 32;
484     tmp_unused = CALL_METHOD_WITH_ARGS1( tmp_called_instance_1, const_str_plain_compiled_method, &PyTuple_GET_ITEM( const_tuple_str_plain_some_tuple, 0 ) );
485  
486     if ( tmp_unused == NULL )
487     {
488         assert( ERROR_OCCURRED() );
489  
490         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
491  
492  
493         exception_lineno = 32;
494         goto frame_exception_exit_1;
495     }
496     Py_DECREF( tmp_unused );
497     tmp_called_instance_2 = var_inst;
498  
499     if ( tmp_called_instance_2 == NULL )
500     {
501  
502         exception_type = PyExc_UnboundLocalError;
503         Py_INCREF( exception_type );
504         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inst" );
505         exception_tb = NULL;
506         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
507         CHAIN_EXCEPTION( exception_value );
508  
509         exception_lineno = 33;
510         goto frame_exception_exit_1;
511     }
512  
513     frame_function->f_lineno = 33;
514     tmp_unused = CALL_METHOD_WITH_ARGS1( tmp_called_instance_2, const_str_plain_compiled_method, &PyTuple_GET_ITEM( const_tuple_str_plain_some_tuple, 0 ) );
515  
516     if ( tmp_unused == NULL )
517     {
518         assert( ERROR_OCCURRED() );
519  
520         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
521  
522  
523         exception_lineno = 33;
524         goto frame_exception_exit_1;
525     }
526     Py_DECREF( tmp_unused );
527     tmp_called_instance_3 = var_inst;
528  
529     if ( tmp_called_instance_3 == NULL )
530     {
531  
532         exception_type = PyExc_UnboundLocalError;
533         Py_INCREF( exception_type );
534         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "inst" );
535         exception_tb = NULL;
536         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
537         CHAIN_EXCEPTION( exception_value );
538  
539         exception_lineno = 34;
540         goto frame_exception_exit_1;
541     }
542  
543     frame_function->f_lineno = 34;
544     tmp_unused = CALL_METHOD_WITH_ARGS1( tmp_called_instance_3, const_str_plain_compiled_method, &PyTuple_GET_ITEM( const_tuple_str_plain_some_tuple, 0 ) );
545  
546     if ( tmp_unused == NULL )
547     {
548         assert( ERROR_OCCURRED() );
549  
550         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
551  
552  
553         exception_lineno = 34;
554         goto frame_exception_exit_1;
555     }
556     Py_DECREF( tmp_unused );
557 472
558 #if 0 473 #if 0
559     RESTORE_FRAME_EXCEPTION( frame_function ); 474     RESTORE_FRAME_EXCEPTION( frame_function );
560 #endif 475 #endif
561     // Put the previous frame back on top. 476     // Put the previous frame back on top.
627     // tried codes exits in all cases 542     // tried codes exits in all cases
628     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly ); 543     NUITKA_CANNOT_GET_HERE( __main__$$$function_1_calledRepeatedly );
629     return NULL; 544     return NULL;
630     // Return handler code: 545     // Return handler code:
631     try_return_handler_1:; 546     try_return_handler_1:;
n n 547     CHECK_OBJECT( (PyObject *)var_inst );
632     Py_XDECREF( var_inst ); 548     Py_DECREF( var_inst );
633     var_inst = NULL; 549     var_inst = NULL;
634 550
635     goto function_return_exit; 551     goto function_return_exit;
636     // Exception handler code: 552     // Exception handler code:
637     try_except_handler_1:; 553     try_except_handler_1:;
641     exception_keeper_lineno_1 = exception_lineno; 557     exception_keeper_lineno_1 = exception_lineno;
642     exception_type = NULL; 558     exception_type = NULL;
643     exception_value = NULL; 559     exception_value = NULL;
644     exception_tb = NULL; 560     exception_tb = NULL;
645     exception_lineno = -1; 561     exception_lineno = -1;
t 646   t
647     Py_XDECREF( var_inst );
648     var_inst = NULL;
649 562
650     // Re-raise. 563     // Re-raise.
651     exception_type = exception_keeper_type_1; 564     exception_type = exception_keeper_type_1;
652     exception_value = exception_keeper_value_1; 565     exception_value = exception_keeper_value_1;
653     exception_tb = exception_keeper_tb_1; 566     exception_tb = exception_keeper_tb_1;