Construct CallCompiledFunctionPosArgsVariable

Performance Diagrams

Construct CallCompiledFunctionPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000220000000220000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)22931490888.11538461538461257.0CPython 2.759999699240.03846153846155439.4582333446425Nuitka (master)59999621391.96153846153845439.45831739936085Nuitka (develop)59999063543.8846153846154439.45891871388426Nuitka (factory)Construct CallCompiledFunctionPosArgsVariableTicks Construct CallCompiledFunctionPosArgsVariable 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000200000000200000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)21816849688.11538461538461257.0CPython 3.568848111240.03846153846155426.13241392190884Nuitka (master)68847173391.96153846153845426.1334763770067Nuitka (develop)68847231543.8846153846154426.1334106814889Nuitka (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



import itertools
for x in itertools.repeat(None, 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

import itertools
for x in itertools.repeat(None, 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 import itertools 46 import itertools
47 for x in itertools.repeat(None, 50000): 47 for x in itertools.repeat(None, 50000):
48     calledRepeatedly() 48     calledRepeatedly()
49 49

Context Diff of Generated Code


Construct
Baseline
285     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 285     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
286     PyObject *exception_keeper_type_1; 286     PyObject *exception_keeper_type_1;
287     PyObject *exception_keeper_value_1; 287     PyObject *exception_keeper_value_1;
288     PyTracebackObject *exception_keeper_tb_1; 288     PyTracebackObject *exception_keeper_tb_1;
289     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; 289     NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1;
n 290     PyObject *tmp_args_element_name_1; n
291     PyObject *tmp_args_element_name_2;
292     PyObject *tmp_args_element_name_3;
293     PyObject *tmp_args_element_name_4;
294     PyObject *tmp_args_element_name_5;
295     PyObject *tmp_args_element_name_6;
296     PyObject *tmp_args_element_name_7;
297     PyObject *tmp_args_element_name_8;
298     PyObject *tmp_args_element_name_9;
299     PyObject *tmp_args_element_name_10;
300     PyObject *tmp_args_element_name_11;
301     PyObject *tmp_args_element_name_12;
302     PyObject *tmp_args_element_name_13;
303     PyObject *tmp_args_element_name_14;
304     PyObject *tmp_args_element_name_15;
305     PyObject *tmp_args_element_name_16;
306     PyObject *tmp_args_element_name_17;
307     PyObject *tmp_args_element_name_18;
308     PyObject *tmp_assign_source_1; 290     PyObject *tmp_assign_source_1;
309     PyObject *tmp_assign_source_2; 291     PyObject *tmp_assign_source_2;
310     PyObject *tmp_assign_source_3; 292     PyObject *tmp_assign_source_3;
311     PyObject *tmp_assign_source_4; 293     PyObject *tmp_assign_source_4;
312     PyObject *tmp_assign_source_5; 294     PyObject *tmp_assign_source_5;
315     PyObject *tmp_called_name_2; 297     PyObject *tmp_called_name_2;
316     PyObject *tmp_called_name_3; 298     PyObject *tmp_called_name_3;
317     PyObject *tmp_called_name_4; 299     PyObject *tmp_called_name_4;
318     PyObject *tmp_called_name_5; 300     PyObject *tmp_called_name_5;
319     PyObject *tmp_called_name_6; 301     PyObject *tmp_called_name_6;
n 320     PyObject *tmp_called_name_7; n
321     PyObject *tmp_called_name_8;
322     PyObject *tmp_called_name_9;
323     PyObject *tmp_return_value; 302     PyObject *tmp_return_value;
n 324     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
325     static struct Nuitka_FrameObject *cache_frame_15757e64a450bf4e788e3262ec6f4adc = NULL; 303     static struct Nuitka_FrameObject *cache_frame_15757e64a450bf4e788e3262ec6f4adc = NULL;
326 304
327     struct Nuitka_FrameObject *frame_15757e64a450bf4e788e3262ec6f4adc; 305     struct Nuitka_FrameObject *frame_15757e64a450bf4e788e3262ec6f4adc;
328 306
329     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 307     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
567         goto frame_exception_exit_1; 545         goto frame_exception_exit_1;
568     } 546     }
569     assert( var_f == NULL ); 547     assert( var_f == NULL );
570     var_f = tmp_assign_source_6; 548     var_f = tmp_assign_source_6;
571 549
n 572     tmp_called_name_7 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func ); n
573  
574     if (unlikely( tmp_called_name_7 == NULL ))
575     {
576         tmp_called_name_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func );
577     }
578  
579     if ( tmp_called_name_7 == NULL )
580     {
581  
582         exception_type = PyExc_NameError;
583         Py_INCREF( exception_type );
584         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "compiled_func" );
585         exception_tb = NULL;
586         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
587         CHAIN_EXCEPTION( exception_value );
588  
589         exception_lineno = 39;
590         type_description_1 = "oooooo";
591         goto frame_exception_exit_1;
592     }
593  
594     tmp_args_element_name_1 = var_a;
595  
596     if ( tmp_args_element_name_1 == NULL )
597     {
598  
599         exception_type = PyExc_UnboundLocalError;
600         Py_INCREF( exception_type );
601         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "a" );
602         exception_tb = NULL;
603         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
604         CHAIN_EXCEPTION( exception_value );
605  
606         exception_lineno = 39;
607         type_description_1 = "oooooo";
608         goto frame_exception_exit_1;
609     }
610  
611     tmp_args_element_name_2 = var_b;
612  
613     if ( tmp_args_element_name_2 == NULL )
614     {
615  
616         exception_type = PyExc_UnboundLocalError;
617         Py_INCREF( exception_type );
618         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "b" );
619         exception_tb = NULL;
620         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
621         CHAIN_EXCEPTION( exception_value );
622  
623         exception_lineno = 39;
624         type_description_1 = "oooooo";
625         goto frame_exception_exit_1;
626     }
627  
628     tmp_args_element_name_3 = var_c;
629  
630     if ( tmp_args_element_name_3 == NULL )
631     {
632  
633         exception_type = PyExc_UnboundLocalError;
634         Py_INCREF( exception_type );
635         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "c" );
636         exception_tb = NULL;
637         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
638         CHAIN_EXCEPTION( exception_value );
639  
640         exception_lineno = 39;
641         type_description_1 = "oooooo";
642         goto frame_exception_exit_1;
643     }
644  
645     tmp_args_element_name_4 = var_d;
646  
647     if ( tmp_args_element_name_4 == NULL )
648     {
649  
650         exception_type = PyExc_UnboundLocalError;
651         Py_INCREF( exception_type );
652         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "d" );
653         exception_tb = NULL;
654         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
655         CHAIN_EXCEPTION( exception_value );
656  
657         exception_lineno = 39;
658         type_description_1 = "oooooo";
659         goto frame_exception_exit_1;
660     }
661  
662     tmp_args_element_name_5 = var_e;
663  
664     if ( tmp_args_element_name_5 == NULL )
665     {
666  
667         exception_type = PyExc_UnboundLocalError;
668         Py_INCREF( exception_type );
669         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "e" );
670         exception_tb = NULL;
671         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
672         CHAIN_EXCEPTION( exception_value );
673  
674         exception_lineno = 39;
675         type_description_1 = "oooooo";
676         goto frame_exception_exit_1;
677     }
678  
679     tmp_args_element_name_6 = var_f;
680  
681     CHECK_OBJECT( tmp_args_element_name_6 );
682     frame_15757e64a450bf4e788e3262ec6f4adc->m_frame.f_lineno = 39;
683     {
684         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 };
685         tmp_unused = CALL_FUNCTION_WITH_ARGS6( tmp_called_name_7, call_args );
686     }
687  
688     if ( tmp_unused == NULL )
689     {
690         assert( ERROR_OCCURRED() );
691  
692         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
693  
694  
695         exception_lineno = 39;
696         type_description_1 = "oooooo";
697         goto frame_exception_exit_1;
698     }
699     Py_DECREF( tmp_unused );
700     tmp_called_name_8 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func );
701  
702     if (unlikely( tmp_called_name_8 == NULL ))
703     {
704         tmp_called_name_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func );
705     }
706  
707     if ( tmp_called_name_8 == NULL )
708     {
709  
710         exception_type = PyExc_NameError;
711         Py_INCREF( exception_type );
712         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "compiled_func" );
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_1 = "oooooo";
719         goto frame_exception_exit_1;
720     }
721  
722     tmp_args_element_name_7 = var_a;
723  
724     if ( tmp_args_element_name_7 == NULL )
725     {
726  
727         exception_type = PyExc_UnboundLocalError;
728         Py_INCREF( exception_type );
729         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "a" );
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_1 = "oooooo";
736         goto frame_exception_exit_1;
737     }
738  
739     tmp_args_element_name_8 = var_c;
740  
741     if ( tmp_args_element_name_8 == NULL )
742     {
743  
744         exception_type = PyExc_UnboundLocalError;
745         Py_INCREF( exception_type );
746         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "c" );
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_1 = "oooooo";
753         goto frame_exception_exit_1;
754     }
755  
756     tmp_args_element_name_9 = var_b;
757  
758     if ( tmp_args_element_name_9 == NULL )
759     {
760  
761         exception_type = PyExc_UnboundLocalError;
762         Py_INCREF( exception_type );
763         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "b" );
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_1 = "oooooo";
770         goto frame_exception_exit_1;
771     }
772  
773     tmp_args_element_name_10 = var_d;
774  
775     if ( tmp_args_element_name_10 == NULL )
776     {
777  
778         exception_type = PyExc_UnboundLocalError;
779         Py_INCREF( exception_type );
780         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "d" );
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_1 = "oooooo";
787         goto frame_exception_exit_1;
788     }
789  
790     tmp_args_element_name_11 = var_e;
791  
792     if ( tmp_args_element_name_11 == NULL )
793     {
794  
795         exception_type = PyExc_UnboundLocalError;
796         Py_INCREF( exception_type );
797         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "e" );
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_1 = "oooooo";
804         goto frame_exception_exit_1;
805     }
806  
807     tmp_args_element_name_12 = var_f;
808  
809     if ( tmp_args_element_name_12 == NULL )
810     {
811  
812         exception_type = PyExc_UnboundLocalError;
813         Py_INCREF( exception_type );
814         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
815         exception_tb = NULL;
816         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
817         CHAIN_EXCEPTION( exception_value );
818  
819         exception_lineno = 40;
820         type_description_1 = "oooooo";
821         goto frame_exception_exit_1;
822     }
823  
824     frame_15757e64a450bf4e788e3262ec6f4adc->m_frame.f_lineno = 40;
825     {
826         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 };
827         tmp_unused = CALL_FUNCTION_WITH_ARGS6( tmp_called_name_8, call_args );
828     }
829  
830     if ( tmp_unused == NULL )
831     {
832         assert( ERROR_OCCURRED() );
833  
834         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
835  
836  
837         exception_lineno = 40;
838         type_description_1 = "oooooo";
839         goto frame_exception_exit_1;
840     }
841     Py_DECREF( tmp_unused );
842     tmp_called_name_9 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func );
843  
844     if (unlikely( tmp_called_name_9 == NULL ))
845     {
846         tmp_called_name_9 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func );
847     }
848  
849     if ( tmp_called_name_9 == NULL )
850     {
851  
852         exception_type = PyExc_NameError;
853         Py_INCREF( exception_type );
854         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "compiled_func" );
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_1 = "oooooo";
861         goto frame_exception_exit_1;
862     }
863  
864     tmp_args_element_name_13 = var_a;
865  
866     if ( tmp_args_element_name_13 == NULL )
867     {
868  
869         exception_type = PyExc_UnboundLocalError;
870         Py_INCREF( exception_type );
871         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "a" );
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_1 = "oooooo";
878         goto frame_exception_exit_1;
879     }
880  
881     tmp_args_element_name_14 = var_b;
882  
883     if ( tmp_args_element_name_14 == NULL )
884     {
885  
886         exception_type = PyExc_UnboundLocalError;
887         Py_INCREF( exception_type );
888         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "b" );
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_1 = "oooooo";
895         goto frame_exception_exit_1;
896     }
897  
898     tmp_args_element_name_15 = var_c;
899  
900     if ( tmp_args_element_name_15 == NULL )
901     {
902  
903         exception_type = PyExc_UnboundLocalError;
904         Py_INCREF( exception_type );
905         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "c" );
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_1 = "oooooo";
912         goto frame_exception_exit_1;
913     }
914  
915     tmp_args_element_name_16 = var_d;
916  
917     if ( tmp_args_element_name_16 == NULL )
918     {
919  
920         exception_type = PyExc_UnboundLocalError;
921         Py_INCREF( exception_type );
922         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "d" );
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_1 = "oooooo";
929         goto frame_exception_exit_1;
930     }
931  
932     tmp_args_element_name_17 = var_f;
933  
934     if ( tmp_args_element_name_17 == NULL )
935     {
936  
937         exception_type = PyExc_UnboundLocalError;
938         Py_INCREF( exception_type );
939         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
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_1 = "oooooo";
946         goto frame_exception_exit_1;
947     }
948  
949     tmp_args_element_name_18 = var_e;
950  
951     if ( tmp_args_element_name_18 == NULL )
952     {
953  
954         exception_type = PyExc_UnboundLocalError;
955         Py_INCREF( exception_type );
956         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "e" );
957         exception_tb = NULL;
958         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
959         CHAIN_EXCEPTION( exception_value );
960  
961         exception_lineno = 41;
962         type_description_1 = "oooooo";
963         goto frame_exception_exit_1;
964     }
965  
966     frame_15757e64a450bf4e788e3262ec6f4adc->m_frame.f_lineno = 41;
967     {
968         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 };
969         tmp_unused = CALL_FUNCTION_WITH_ARGS6( tmp_called_name_9, call_args );
970     }
971  
972     if ( tmp_unused == NULL )
973     {
974         assert( ERROR_OCCURRED() );
975  
976         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
977  
978  
979         exception_lineno = 41;
980         type_description_1 = "oooooo";
981         goto frame_exception_exit_1;
982     }
983     Py_DECREF( tmp_unused );
984 550
985 #if 0 551 #if 0
986     RESTORE_FRAME_EXCEPTION( frame_15757e64a450bf4e788e3262ec6f4adc ); 552     RESTORE_FRAME_EXCEPTION( frame_15757e64a450bf4e788e3262ec6f4adc );
987 #endif 553 #endif
988 554
1086     Py_XDECREF( var_d ); 652     Py_XDECREF( var_d );
1087     var_d = NULL; 653     var_d = NULL;
1088 654
1089     Py_XDECREF( var_e ); 655     Py_XDECREF( var_e );
1090     var_e = NULL; 656     var_e = NULL;
t 1091   t
1092     Py_XDECREF( var_f );
1093     var_f = NULL;
1094 657
1095     // Re-raise. 658     // Re-raise.
1096     exception_type = exception_keeper_type_1; 659     exception_type = exception_keeper_type_1;
1097     exception_value = exception_keeper_value_1; 660     exception_value = exception_keeper_value_1;
1098     exception_tb = exception_keeper_tb_1; 661     exception_tb = exception_keeper_tb_1;