Construct InplaceOperationInstanceStringAdd

Performance Diagrams

Construct InplaceOperationInstanceStringAdd 001000000001000000002000000002000000003000000003000000004000000004000000005000000005000000006000000006000000007000000007000000008000000008000000009000000009000000001000000000100000000011000000001100000000120000000012000000001300000000130000000014000000001400000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)143084968672.23076923076923257.0CPython 2.71420700532192.61538461538458258.7528131143126Nuitka (historic)1417250764313.0259.34860647716187Nuitka (master)1417251624433.38461538461536259.34845795056765Nuitka (develop)1417251180553.7692307692307259.34853463173954Nuitka (factory)Construct InplaceOperationInstanceStringAddTicks Construct InplaceOperationInstanceStringAdd 001000000001000000002000000002000000003000000003000000004000000004000000005000000005000000006000000006000000007000000007000000008000000008000000009000000009000000001000000000100000000011000000001100000000120000000012000000001300000000130000000014000000001400000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)144968386672.23076923076923257.0CPython 3.50192.61538461538458504.11538461538464Nuitka (historic)1439661014313.0258.7085110657657Nuitka (master)1444166200433.38461538461536257.94054999696687Nuitka (develop)1444156861553.7692307692307257.94214193754857Nuitka (factory)Construct InplaceOperationInstanceStringAddTicks

Source Code with Construct

module_value1 = 5

class C:
    def __init__(self):

        self.s = '2' * 100000

    def increment(self):
        additiv = '*' * 1000

# construct_begin
        self.s += additiv
# construct_end

        return additiv

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = C()

    local_value.increment()

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

module_value1 = 5

class C:
    def __init__(self):

        self.s = '2' * 100000

    def increment(self):
        additiv = '*' * 1000

# construct_begin



        return additiv

def calledRepeatedly():
    # Force frame and eliminate forward propagation (currently).
    module_value1

    local_value = C()

    local_value.increment()

for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Context Diff of Source Code


Construct
Baseline
27 27
28     def increment(self): 28     def increment(self):
29         additiv = '*' * 1000 29         additiv = '*' * 1000
30 30
31 # construct_begin 31 # construct_begin
t 32         self.s += additiv t 32  
33 # construct_end 33  
34 34
35         return additiv 35         return additiv
36 36
37 def calledRepeatedly(): 37 def calledRepeatedly():
38     # Force frame and eliminate forward propagation (currently). 38     # Force frame and eliminate forward propagation (currently).

Context Diff of Generated Code


Construct
Baseline
592 #endif 592 #endif
593 593
594     // Local variable declarations. 594     // Local variable declarations.
595     PyObject *par_self = python_pars[ 0 ]; 595     PyObject *par_self = python_pars[ 0 ];
596     PyObject *var_additiv = NULL; 596     PyObject *var_additiv = NULL;
n 597     PyObject *tmp_inplace_assign_attr_1__start = NULL; n
598     PyObject *tmp_inplace_assign_attr_1__end = NULL;
599     PyObject *exception_type = NULL, *exception_value = NULL; 597     PyObject *exception_type = NULL, *exception_value = NULL;
600     PyTracebackObject *exception_tb = NULL; 598     PyTracebackObject *exception_tb = NULL;
601     NUITKA_MAY_BE_UNUSED int exception_lineno = -1; 599     NUITKA_MAY_BE_UNUSED int exception_lineno = -1;
602     PyObject *exception_keeper_type_1; 600     PyObject *exception_keeper_type_1;
603     PyObject *exception_keeper_value_1; 601     PyObject *exception_keeper_value_1;
604     PyTracebackObject *exception_keeper_tb_1; 602     PyTracebackObject *exception_keeper_tb_1;
605     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 603     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
n 606     PyObject *exception_keeper_type_2; n
607     PyObject *exception_keeper_value_2;
608     PyTracebackObject *exception_keeper_tb_2;
609     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2;
610     PyObject *exception_keeper_type_3;
611     PyObject *exception_keeper_value_3;
612     PyTracebackObject *exception_keeper_tb_3;
613     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3;
614     PyObject *tmp_assattr_name_1;
615     PyObject *tmp_assattr_target_1;
616     PyObject *tmp_assign_source_1; 604     PyObject *tmp_assign_source_1;
n 617     PyObject *tmp_assign_source_2; n
618     PyObject *tmp_assign_source_3;
619     PyObject *tmp_compare_left_1;
620     PyObject *tmp_compare_right_1;
621     PyObject *tmp_frame_locals; 605     PyObject *tmp_frame_locals;
n 622     bool tmp_isnot_1; n
623     PyObject *tmp_left_name_1; 606     PyObject *tmp_left_name_1;
n 624     PyObject *tmp_left_name_2; n
625     bool tmp_result;
626     PyObject *tmp_return_value; 607     PyObject *tmp_return_value;
627     PyObject *tmp_right_name_1; 608     PyObject *tmp_right_name_1;
n 628     PyObject *tmp_right_name_2; n
629     PyObject *tmp_source_name_1;
630     static PyFrameObject *cache_frame_function = NULL; 609     static PyFrameObject *cache_frame_function = NULL;
631 610
632     PyFrameObject *frame_function; 611     PyFrameObject *frame_function;
633 612
634     tmp_return_value = NULL; 613     tmp_return_value = NULL;
664         goto frame_exception_exit_1; 643         goto frame_exception_exit_1;
665     } 644     }
666     assert( var_additiv == NULL ); 645     assert( var_additiv == NULL );
667     var_additiv = tmp_assign_source_1; 646     var_additiv = tmp_assign_source_1;
668 647
n 669     tmp_source_name_1 = par_self; n
670  
671     tmp_assign_source_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_s );
672     if ( tmp_assign_source_2 == NULL )
673     {
674         assert( ERROR_OCCURRED() );
675  
676         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
677  
678  
679         exception_lineno = 32;
680         goto frame_exception_exit_1;
681     }
682     assert( tmp_inplace_assign_attr_1__start == NULL );
683     tmp_inplace_assign_attr_1__start = tmp_assign_source_2;
684  
685     // Tried code:
686     tmp_left_name_2 = tmp_inplace_assign_attr_1__start;
687  
688     tmp_right_name_2 = var_additiv;
689  
690     if ( tmp_right_name_2 == NULL )
691     {
692  
693         exception_type = PyExc_UnboundLocalError;
694         Py_INCREF( exception_type );
695         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "additiv" );
696         exception_tb = NULL;
697         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
698         CHAIN_EXCEPTION( exception_value );
699  
700         exception_lineno = 32;
701         goto try_except_handler_2;
702     }
703  
704     tmp_assign_source_3 = BINARY_OPERATION( PyNumber_InPlaceAdd, tmp_left_name_2, tmp_right_name_2 );
705     if ( tmp_assign_source_3 == NULL )
706     {
707         assert( ERROR_OCCURRED() );
708  
709         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
710  
711  
712         exception_lineno = 32;
713         goto try_except_handler_2;
714     }
715     assert( tmp_inplace_assign_attr_1__end == NULL );
716     tmp_inplace_assign_attr_1__end = tmp_assign_source_3;
717  
718     // Tried code:
719     tmp_compare_left_1 = tmp_inplace_assign_attr_1__start;
720  
721     tmp_compare_right_1 = tmp_inplace_assign_attr_1__end;
722  
723     tmp_isnot_1 = ( tmp_compare_left_1 != tmp_compare_right_1 );
724     if ( tmp_isnot_1 )
725     {
726         goto branch_yes_1;
727     }
728     else
729     {
730         goto branch_no_1;
731     }
732     branch_yes_1:;
733     tmp_assattr_name_1 = tmp_inplace_assign_attr_1__end;
734  
735     tmp_assattr_target_1 = par_self;
736  
737     if ( tmp_assattr_target_1 == NULL )
738     {
739  
740         exception_type = PyExc_UnboundLocalError;
741         Py_INCREF( exception_type );
742         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "self" );
743         exception_tb = NULL;
744         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
745         CHAIN_EXCEPTION( exception_value );
746  
747         exception_lineno = 32;
748         goto try_except_handler_3;
749     }
750  
751     tmp_result = SET_ATTRIBUTE( tmp_assattr_target_1, const_str_plain_s, tmp_assattr_name_1 );
752     if ( tmp_result == false )
753     {
754         assert( ERROR_OCCURRED() );
755  
756         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
757  
758  
759         exception_lineno = 32;
760         goto try_except_handler_3;
761     }
762     branch_no_1:;
763     goto try_end_1;
764     // Exception handler code:
765     try_except_handler_3:;
766     exception_keeper_type_1 = exception_type;
767     exception_keeper_value_1 = exception_value;
768     exception_keeper_tb_1 = exception_tb;
769     exception_keeper_lineno_1 = exception_lineno;
770     exception_type = NULL;
771     exception_value = NULL;
772     exception_tb = NULL;
773     exception_lineno = -1;
774  
775     Py_XDECREF( tmp_inplace_assign_attr_1__end );
776     tmp_inplace_assign_attr_1__end = NULL;
777  
778     // Re-raise.
779     exception_type = exception_keeper_type_1;
780     exception_value = exception_keeper_value_1;
781     exception_tb = exception_keeper_tb_1;
782     exception_lineno = exception_keeper_lineno_1;
783  
784     goto try_except_handler_2;
785     // End of try:
786     try_end_1:;
787     goto try_end_2;
788     // Exception handler code:
789     try_except_handler_2:;
790     exception_keeper_type_2 = exception_type;
791     exception_keeper_value_2 = exception_value;
792     exception_keeper_tb_2 = exception_tb;
793     exception_keeper_lineno_2 = exception_lineno;
794     exception_type = NULL;
795     exception_value = NULL;
796     exception_tb = NULL;
797     exception_lineno = -1;
798  
799     Py_XDECREF( tmp_inplace_assign_attr_1__start );
800     tmp_inplace_assign_attr_1__start = NULL;
801  
802     // Re-raise.
803     exception_type = exception_keeper_type_2;
804     exception_value = exception_keeper_value_2;
805     exception_tb = exception_keeper_tb_2;
806     exception_lineno = exception_keeper_lineno_2;
807  
808     goto frame_exception_exit_1;
809     // End of try:
810     try_end_2:;
811     Py_XDECREF( tmp_inplace_assign_attr_1__end );
812     tmp_inplace_assign_attr_1__end = NULL;
813  
814     Py_XDECREF( tmp_inplace_assign_attr_1__start );
815     tmp_inplace_assign_attr_1__start = NULL;
816  
817     tmp_return_value = var_additiv;
818  
819     if ( tmp_return_value == NULL )
820     {
821  
822         exception_type = PyExc_UnboundLocalError;
823         Py_INCREF( exception_type );
824         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "additiv" );
825         exception_tb = NULL;
826         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
827         CHAIN_EXCEPTION( exception_value );
828  
829         exception_lineno = 35;
830         goto frame_exception_exit_1;
831     }
832  
833     Py_INCREF( tmp_return_value );
834     goto frame_return_exit_1;
835 648
836 #if 0 649 #if 0
837     RESTORE_FRAME_EXCEPTION( frame_function ); 650     RESTORE_FRAME_EXCEPTION( frame_function );
838 #endif 651 #endif
839     // Put the previous frame back on top. 652     // Put the previous frame back on top.
841 #if PYTHON_VERSION >= 340 654 #if PYTHON_VERSION >= 340
842     frame_function->f_executing -= 1; 655     frame_function->f_executing -= 1;
843 #endif 656 #endif
844     Py_DECREF( frame_function ); 657     Py_DECREF( frame_function );
845     goto frame_no_exception_1; 658     goto frame_no_exception_1;
n 846   n
847     frame_return_exit_1:;
848 #if 0
849     RESTORE_FRAME_EXCEPTION( frame_function );
850 #endif
851     popFrameStack();
852 #if PYTHON_VERSION >= 340
853     frame_function->f_executing -= 1;
854 #endif
855     Py_DECREF( frame_function );
856     goto try_return_handler_1;
857 659
858     frame_exception_exit_1:; 660     frame_exception_exit_1:;
859 #if 0 661 #if 0
860     RESTORE_FRAME_EXCEPTION( frame_function ); 662     RESTORE_FRAME_EXCEPTION( frame_function );
861 #endif 663 #endif
919     // Return the error. 721     // Return the error.
920     goto try_except_handler_1; 722     goto try_except_handler_1;
921 723
922     frame_no_exception_1:; 724     frame_no_exception_1:;
923 725
n n 726     tmp_return_value = var_additiv;
727  
728     Py_INCREF( tmp_return_value );
729     goto try_return_handler_1;
924     // tried codes exits in all cases 730     // tried codes exits in all cases
925     NUITKA_CANNOT_GET_HERE( __main__$$$class_1_C$$$function_2_increment ); 731     NUITKA_CANNOT_GET_HERE( __main__$$$class_1_C$$$function_2_increment );
926     return NULL; 732     return NULL;
927     // Return handler code: 733     // Return handler code:
928     try_return_handler_1:; 734     try_return_handler_1:;
n n 735     CHECK_OBJECT( (PyObject *)par_self );
929     Py_XDECREF( par_self ); 736     Py_DECREF( par_self );
930     par_self = NULL; 737     par_self = NULL;
931 738
932     Py_XDECREF( var_additiv ); 739     Py_XDECREF( var_additiv );
933     var_additiv = NULL; 740     var_additiv = NULL;
934 741
935     goto function_return_exit; 742     goto function_return_exit;
936     // Exception handler code: 743     // Exception handler code:
937     try_except_handler_1:; 744     try_except_handler_1:;
n 938     exception_keeper_type_3 = exception_type; n 745     exception_keeper_type_1 = exception_type;
939     exception_keeper_value_3 = exception_value; 746     exception_keeper_value_1 = exception_value;
940     exception_keeper_tb_3 = exception_tb; 747     exception_keeper_tb_1 = exception_tb;
941     exception_keeper_lineno_3 = exception_lineno; 748     exception_keeper_lineno_1 = exception_lineno;
942     exception_type = NULL; 749     exception_type = NULL;
943     exception_value = NULL; 750     exception_value = NULL;
944     exception_tb = NULL; 751     exception_tb = NULL;
945     exception_lineno = -1; 752     exception_lineno = -1;
946 753
n n 754     CHECK_OBJECT( (PyObject *)par_self );
947     Py_XDECREF( par_self ); 755     Py_DECREF( par_self );
948     par_self = NULL; 756     par_self = NULL;
949 757
n 950     Py_XDECREF( var_additiv ); n
951     var_additiv = NULL;
952  
953     // Re-raise. 758     // Re-raise.
t 954     exception_type = exception_keeper_type_3; t 759     exception_type = exception_keeper_type_1;
955     exception_value = exception_keeper_value_3; 760     exception_value = exception_keeper_value_1;
956     exception_tb = exception_keeper_tb_3; 761     exception_tb = exception_keeper_tb_1;
957     exception_lineno = exception_keeper_lineno_3; 762     exception_lineno = exception_keeper_lineno_1;
958 763
959     goto function_exception_exit; 764     goto function_exception_exit;
960     // End of try: 765     // End of try:
961 766
962     // Return statement must have exited already. 767     // Return statement must have exited already.