Construct CallCompiledFunctionPosArgsVariable

Performance Diagrams

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