Construct CallCompiledFunctionPosArgsVariable

Performance Diagrams

Construct CallCompiledFunctionPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 2.7Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)22931457372.9230769230769257.0CPython 2.774100270194.46153846153845424.262994592384Nuitka (historic)59999514316.0439.45833824944714Nuitka (master)60000006437.53846153846143439.4578080573724Nuitka (develop)60000018559.0769230769231439.4577951258584Nuitka (factory)Construct CallCompiledFunctionPosArgsVariableTicks Construct CallCompiledFunctionPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 3.5Nuitka (historic)Nuitka (master)Nuitka (develop)Nuitka (factory)21816935872.9230769230769257.0CPython 3.50194.46153846153845504.11538461538464Nuitka (historic)68839779316.0426.14215950087026Nuitka (master)68850207437.53846153846143426.1303479465146Nuitka (develop)68849483559.0769230769231426.1311680045653Nuitka (factory)Construct CallCompiledFunctionPosArgsVariableTicks

Source Code with Construct

from __future__ import print_function

def compiled_func(a,b,c,d,e,f):
    return a, b, c, d, e, f

def getUnknownValue():
    return 8

def calledRepeatedly():
    a = getUnknownValue()
    b = getUnknownValue()
    c = getUnknownValue()
    d = getUnknownValue()
    e = getUnknownValue()
    f = getUnknownValue()

    # This is supposed to make a call to a non-compiled function, which is
    # being optimized separately.
# construct_begin
    compiled_func(a, b, c, d, e, f)
    compiled_func(a, c, b, d, e, f)
    compiled_func(a, b, c, d, f, e)
# construct_alternative



for x in xrange(50000):
    calledRepeatedly()

print("OK.")

Source Code without Construct

from __future__ import print_function

def compiled_func(a,b,c,d,e,f):
    return a, b, c, d, e, f

def getUnknownValue():
    return 8

def calledRepeatedly():
    a = getUnknownValue()
    b = getUnknownValue()
    c = getUnknownValue()
    d = getUnknownValue()
    e = getUnknownValue()
    f = getUnknownValue()

    # 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
34     f = getUnknownValue() 34     f = getUnknownValue()
35 35
36     # This is supposed to make a call to a non-compiled function, which is 36     # This is supposed to make a call to a non-compiled function, which is
37     # being optimized separately. 37     # being optimized separately.
38 # construct_begin 38 # construct_begin
n 39     compiled_func(a, b, c, d, e, f) n
40     compiled_func(a, c, b, d, e, f)
41     compiled_func(a, b, c, d, f, e)
42 # construct_alternative
43 39
44 40
t t 41  
42 # construct_alternative
43     pass
44 # construct_end
45 45
46 for x in xrange(50000): 46 for x in xrange(50000):
47     calledRepeatedly() 47     calledRepeatedly()
48 48
49 print("OK.") 49 print("OK.")

Context Diff of Generated Code


Construct
Baseline
274     NUITKA_MAY_BE_UNUSED int exception_lineno = -1; 274     NUITKA_MAY_BE_UNUSED int exception_lineno = -1;
275     PyObject *exception_keeper_type_1; 275     PyObject *exception_keeper_type_1;
276     PyObject *exception_keeper_value_1; 276     PyObject *exception_keeper_value_1;
277     PyTracebackObject *exception_keeper_tb_1; 277     PyTracebackObject *exception_keeper_tb_1;
278     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 278     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
n 279     PyObject *tmp_args_element_name_1; n
280     PyObject *tmp_args_element_name_2;
281     PyObject *tmp_args_element_name_3;
282     PyObject *tmp_args_element_name_4;
283     PyObject *tmp_args_element_name_5;
284     PyObject *tmp_args_element_name_6;
285     PyObject *tmp_args_element_name_7;
286     PyObject *tmp_args_element_name_8;
287     PyObject *tmp_args_element_name_9;
288     PyObject *tmp_args_element_name_10;
289     PyObject *tmp_args_element_name_11;
290     PyObject *tmp_args_element_name_12;
291     PyObject *tmp_args_element_name_13;
292     PyObject *tmp_args_element_name_14;
293     PyObject *tmp_args_element_name_15;
294     PyObject *tmp_args_element_name_16;
295     PyObject *tmp_args_element_name_17;
296     PyObject *tmp_args_element_name_18;
297     PyObject *tmp_assign_source_1; 279     PyObject *tmp_assign_source_1;
298     PyObject *tmp_assign_source_2; 280     PyObject *tmp_assign_source_2;
299     PyObject *tmp_assign_source_3; 281     PyObject *tmp_assign_source_3;
300     PyObject *tmp_assign_source_4; 282     PyObject *tmp_assign_source_4;
301     PyObject *tmp_assign_source_5; 283     PyObject *tmp_assign_source_5;
304     PyObject *tmp_called_name_2; 286     PyObject *tmp_called_name_2;
305     PyObject *tmp_called_name_3; 287     PyObject *tmp_called_name_3;
306     PyObject *tmp_called_name_4; 288     PyObject *tmp_called_name_4;
307     PyObject *tmp_called_name_5; 289     PyObject *tmp_called_name_5;
308     PyObject *tmp_called_name_6; 290     PyObject *tmp_called_name_6;
n 309     PyObject *tmp_called_name_7; n
310     PyObject *tmp_called_name_8;
311     PyObject *tmp_called_name_9;
312     PyObject *tmp_return_value; 291     PyObject *tmp_return_value;
n 313     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
314     static struct Nuitka_FrameObject *cache_frame_9ef69579e8f0e91bf95857b18af814c3 = NULL; 292     static struct Nuitka_FrameObject *cache_frame_9ef69579e8f0e91bf95857b18af814c3 = NULL;
315 293
316     struct Nuitka_FrameObject *frame_9ef69579e8f0e91bf95857b18af814c3; 294     struct Nuitka_FrameObject *frame_9ef69579e8f0e91bf95857b18af814c3;
317 295
318     char const *type_description; 296     char const *type_description;
556         goto frame_exception_exit_1; 534         goto frame_exception_exit_1;
557     } 535     }
558     assert( var_f == NULL ); 536     assert( var_f == NULL );
559     var_f = tmp_assign_source_6; 537     var_f = tmp_assign_source_6;
560 538
n 561     tmp_called_name_7 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func ); n
562  
563     if (unlikely( tmp_called_name_7 == NULL ))
564     {
565         tmp_called_name_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func );
566     }
567  
568     if ( tmp_called_name_7 == NULL )
569     {
570  
571         exception_type = PyExc_NameError;
572         Py_INCREF( exception_type );
573         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "compiled_func" );
574         exception_tb = NULL;
575         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
576         CHAIN_EXCEPTION( exception_value );
577  
578         exception_lineno = 39;
579         type_description = "oooooo";
580         goto frame_exception_exit_1;
581     }
582  
583     tmp_args_element_name_1 = var_a;
584  
585     if ( tmp_args_element_name_1 == NULL )
586     {
587  
588         exception_type = PyExc_UnboundLocalError;
589         Py_INCREF( exception_type );
590         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "a" );
591         exception_tb = NULL;
592         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
593         CHAIN_EXCEPTION( exception_value );
594  
595         exception_lineno = 39;
596         type_description = "oooooo";
597         goto frame_exception_exit_1;
598     }
599  
600     tmp_args_element_name_2 = var_b;
601  
602     if ( tmp_args_element_name_2 == NULL )
603     {
604  
605         exception_type = PyExc_UnboundLocalError;
606         Py_INCREF( exception_type );
607         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "b" );
608         exception_tb = NULL;
609         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
610         CHAIN_EXCEPTION( exception_value );
611  
612         exception_lineno = 39;
613         type_description = "oooooo";
614         goto frame_exception_exit_1;
615     }
616  
617     tmp_args_element_name_3 = var_c;
618  
619     if ( tmp_args_element_name_3 == NULL )
620     {
621  
622         exception_type = PyExc_UnboundLocalError;
623         Py_INCREF( exception_type );
624         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "c" );
625         exception_tb = NULL;
626         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
627         CHAIN_EXCEPTION( exception_value );
628  
629         exception_lineno = 39;
630         type_description = "oooooo";
631         goto frame_exception_exit_1;
632     }
633  
634     tmp_args_element_name_4 = var_d;
635  
636     if ( tmp_args_element_name_4 == NULL )
637     {
638  
639         exception_type = PyExc_UnboundLocalError;
640         Py_INCREF( exception_type );
641         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "d" );
642         exception_tb = NULL;
643         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
644         CHAIN_EXCEPTION( exception_value );
645  
646         exception_lineno = 39;
647         type_description = "oooooo";
648         goto frame_exception_exit_1;
649     }
650  
651     tmp_args_element_name_5 = var_e;
652  
653     if ( tmp_args_element_name_5 == NULL )
654     {
655  
656         exception_type = PyExc_UnboundLocalError;
657         Py_INCREF( exception_type );
658         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "e" );
659         exception_tb = NULL;
660         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
661         CHAIN_EXCEPTION( exception_value );
662  
663         exception_lineno = 39;
664         type_description = "oooooo";
665         goto frame_exception_exit_1;
666     }
667  
668     tmp_args_element_name_6 = var_f;
669  
670     CHECK_OBJECT( tmp_args_element_name_6 );
671     frame_9ef69579e8f0e91bf95857b18af814c3->m_frame.f_lineno = 39;
672     {
673         PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2, tmp_args_element_name_3, tmp_args_element_name_4, tmp_args_element_name_5, tmp_args_element_name_6 };
674         tmp_unused = CALL_FUNCTION_WITH_ARGS6( tmp_called_name_7, call_args );
675     }
676  
677     if ( tmp_unused == NULL )
678     {
679         assert( ERROR_OCCURRED() );
680  
681         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
682  
683  
684         exception_lineno = 39;
685         type_description = "oooooo";
686         goto frame_exception_exit_1;
687     }
688     Py_DECREF( tmp_unused );
689     tmp_called_name_8 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func );
690  
691     if (unlikely( tmp_called_name_8 == NULL ))
692     {
693         tmp_called_name_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func );
694     }
695  
696     if ( tmp_called_name_8 == NULL )
697     {
698  
699         exception_type = PyExc_NameError;
700         Py_INCREF( exception_type );
701         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "compiled_func" );
702         exception_tb = NULL;
703         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
704         CHAIN_EXCEPTION( exception_value );
705  
706         exception_lineno = 40;
707         type_description = "oooooo";
708         goto frame_exception_exit_1;
709     }
710  
711     tmp_args_element_name_7 = var_a;
712  
713     if ( tmp_args_element_name_7 == NULL )
714     {
715  
716         exception_type = PyExc_UnboundLocalError;
717         Py_INCREF( exception_type );
718         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "a" );
719         exception_tb = NULL;
720         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
721         CHAIN_EXCEPTION( exception_value );
722  
723         exception_lineno = 40;
724         type_description = "oooooo";
725         goto frame_exception_exit_1;
726     }
727  
728     tmp_args_element_name_8 = var_c;
729  
730     if ( tmp_args_element_name_8 == NULL )
731     {
732  
733         exception_type = PyExc_UnboundLocalError;
734         Py_INCREF( exception_type );
735         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "c" );
736         exception_tb = NULL;
737         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
738         CHAIN_EXCEPTION( exception_value );
739  
740         exception_lineno = 40;
741         type_description = "oooooo";
742         goto frame_exception_exit_1;
743     }
744  
745     tmp_args_element_name_9 = var_b;
746  
747     if ( tmp_args_element_name_9 == NULL )
748     {
749  
750         exception_type = PyExc_UnboundLocalError;
751         Py_INCREF( exception_type );
752         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "b" );
753         exception_tb = NULL;
754         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
755         CHAIN_EXCEPTION( exception_value );
756  
757         exception_lineno = 40;
758         type_description = "oooooo";
759         goto frame_exception_exit_1;
760     }
761  
762     tmp_args_element_name_10 = var_d;
763  
764     if ( tmp_args_element_name_10 == NULL )
765     {
766  
767         exception_type = PyExc_UnboundLocalError;
768         Py_INCREF( exception_type );
769         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "d" );
770         exception_tb = NULL;
771         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
772         CHAIN_EXCEPTION( exception_value );
773  
774         exception_lineno = 40;
775         type_description = "oooooo";
776         goto frame_exception_exit_1;
777     }
778  
779     tmp_args_element_name_11 = var_e;
780  
781     if ( tmp_args_element_name_11 == NULL )
782     {
783  
784         exception_type = PyExc_UnboundLocalError;
785         Py_INCREF( exception_type );
786         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "e" );
787         exception_tb = NULL;
788         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
789         CHAIN_EXCEPTION( exception_value );
790  
791         exception_lineno = 40;
792         type_description = "oooooo";
793         goto frame_exception_exit_1;
794     }
795  
796     tmp_args_element_name_12 = var_f;
797  
798     if ( tmp_args_element_name_12 == NULL )
799     {
800  
801         exception_type = PyExc_UnboundLocalError;
802         Py_INCREF( exception_type );
803         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
804         exception_tb = NULL;
805         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
806         CHAIN_EXCEPTION( exception_value );
807  
808         exception_lineno = 40;
809         type_description = "oooooo";
810         goto frame_exception_exit_1;
811     }
812  
813     frame_9ef69579e8f0e91bf95857b18af814c3->m_frame.f_lineno = 40;
814     {
815         PyObject *call_args[] = { tmp_args_element_name_7, tmp_args_element_name_8, tmp_args_element_name_9, tmp_args_element_name_10, tmp_args_element_name_11, tmp_args_element_name_12 };
816         tmp_unused = CALL_FUNCTION_WITH_ARGS6( tmp_called_name_8, call_args );
817     }
818  
819     if ( tmp_unused == NULL )
820     {
821         assert( ERROR_OCCURRED() );
822  
823         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
824  
825  
826         exception_lineno = 40;
827         type_description = "oooooo";
828         goto frame_exception_exit_1;
829     }
830     Py_DECREF( tmp_unused );
831     tmp_called_name_9 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func );
832  
833     if (unlikely( tmp_called_name_9 == NULL ))
834     {
835         tmp_called_name_9 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func );
836     }
837  
838     if ( tmp_called_name_9 == NULL )
839     {
840  
841         exception_type = PyExc_NameError;
842         Py_INCREF( exception_type );
843         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "compiled_func" );
844         exception_tb = NULL;
845         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
846         CHAIN_EXCEPTION( exception_value );
847  
848         exception_lineno = 41;
849         type_description = "oooooo";
850         goto frame_exception_exit_1;
851     }
852  
853     tmp_args_element_name_13 = var_a;
854  
855     if ( tmp_args_element_name_13 == NULL )
856     {
857  
858         exception_type = PyExc_UnboundLocalError;
859         Py_INCREF( exception_type );
860         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "a" );
861         exception_tb = NULL;
862         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
863         CHAIN_EXCEPTION( exception_value );
864  
865         exception_lineno = 41;
866         type_description = "oooooo";
867         goto frame_exception_exit_1;
868     }
869  
870     tmp_args_element_name_14 = var_b;
871  
872     if ( tmp_args_element_name_14 == NULL )
873     {
874  
875         exception_type = PyExc_UnboundLocalError;
876         Py_INCREF( exception_type );
877         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "b" );
878         exception_tb = NULL;
879         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
880         CHAIN_EXCEPTION( exception_value );
881  
882         exception_lineno = 41;
883         type_description = "oooooo";
884         goto frame_exception_exit_1;
885     }
886  
887     tmp_args_element_name_15 = var_c;
888  
889     if ( tmp_args_element_name_15 == NULL )
890     {
891  
892         exception_type = PyExc_UnboundLocalError;
893         Py_INCREF( exception_type );
894         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "c" );
895         exception_tb = NULL;
896         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
897         CHAIN_EXCEPTION( exception_value );
898  
899         exception_lineno = 41;
900         type_description = "oooooo";
901         goto frame_exception_exit_1;
902     }
903  
904     tmp_args_element_name_16 = var_d;
905  
906     if ( tmp_args_element_name_16 == NULL )
907     {
908  
909         exception_type = PyExc_UnboundLocalError;
910         Py_INCREF( exception_type );
911         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "d" );
912         exception_tb = NULL;
913         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
914         CHAIN_EXCEPTION( exception_value );
915  
916         exception_lineno = 41;
917         type_description = "oooooo";
918         goto frame_exception_exit_1;
919     }
920  
921     tmp_args_element_name_17 = var_f;
922  
923     if ( tmp_args_element_name_17 == NULL )
924     {
925  
926         exception_type = PyExc_UnboundLocalError;
927         Py_INCREF( exception_type );
928         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
929         exception_tb = NULL;
930         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
931         CHAIN_EXCEPTION( exception_value );
932  
933         exception_lineno = 41;
934         type_description = "oooooo";
935         goto frame_exception_exit_1;
936     }
937  
938     tmp_args_element_name_18 = var_e;
939  
940     if ( tmp_args_element_name_18 == NULL )
941     {
942  
943         exception_type = PyExc_UnboundLocalError;
944         Py_INCREF( exception_type );
945         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "e" );
946         exception_tb = NULL;
947         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
948         CHAIN_EXCEPTION( exception_value );
949  
950         exception_lineno = 41;
951         type_description = "oooooo";
952         goto frame_exception_exit_1;
953     }
954  
955     frame_9ef69579e8f0e91bf95857b18af814c3->m_frame.f_lineno = 41;
956     {
957         PyObject *call_args[] = { tmp_args_element_name_13, tmp_args_element_name_14, tmp_args_element_name_15, tmp_args_element_name_16, tmp_args_element_name_17, tmp_args_element_name_18 };
958         tmp_unused = CALL_FUNCTION_WITH_ARGS6( tmp_called_name_9, call_args );
959     }
960  
961     if ( tmp_unused == NULL )
962     {
963         assert( ERROR_OCCURRED() );
964  
965         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
966  
967  
968         exception_lineno = 41;
969         type_description = "oooooo";
970         goto frame_exception_exit_1;
971     }
972     Py_DECREF( tmp_unused );
973 539
974 #if 0 540 #if 0
975     RESTORE_FRAME_EXCEPTION( frame_9ef69579e8f0e91bf95857b18af814c3 ); 541     RESTORE_FRAME_EXCEPTION( frame_9ef69579e8f0e91bf95857b18af814c3 );
976 #endif 542 #endif
977 543
1065     Py_XDECREF( var_d ); 631     Py_XDECREF( var_d );
1066     var_d = NULL; 632     var_d = NULL;
1067 633
1068     Py_XDECREF( var_e ); 634     Py_XDECREF( var_e );
1069     var_e = NULL; 635     var_e = NULL;
t 1070   t
1071     Py_XDECREF( var_f );
1072     var_f = NULL;
1073 636
1074     // Re-raise. 637     // Re-raise.
1075     exception_type = exception_keeper_type_1; 638     exception_type = exception_keeper_type_1;
1076     exception_value = exception_keeper_value_1; 639     exception_value = exception_keeper_value_1;
1077     exception_tb = exception_keeper_tb_1; 640     exception_tb = exception_keeper_tb_1;