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)60050853437.53846153846143439.4030139995977Nuitka (develop)60050744559.0769230769231439.4031314608501Nuitka (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)68816347437.53846153846143426.1687003851878Nuitka (develop)68802473559.0769230769231426.18441514402275Nuitka (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_frame_locals; 286     PyObject *tmp_frame_locals;
308     PyObject *tmp_return_value; 287     PyObject *tmp_return_value;
n 309     NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; n
310     static PyFrameObject *cache_frame_function = NULL; 288     static PyFrameObject *cache_frame_function = NULL;
311 289
312     PyFrameObject *frame_function; 290     PyFrameObject *frame_function;
313 291
314     tmp_return_value = NULL; 292     tmp_return_value = NULL;
544         goto frame_exception_exit_1; 522         goto frame_exception_exit_1;
545     } 523     }
546     assert( var_f == NULL ); 524     assert( var_f == NULL );
547     var_f = tmp_assign_source_6; 525     var_f = tmp_assign_source_6;
548 526
n 549     tmp_called_name_7 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func ); n
550  
551     if (unlikely( tmp_called_name_7 == NULL ))
552     {
553         tmp_called_name_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func );
554     }
555  
556     if ( tmp_called_name_7 == NULL )
557     {
558  
559         exception_type = PyExc_NameError;
560         Py_INCREF( exception_type );
561         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "compiled_func" );
562         exception_tb = NULL;
563         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
564         CHAIN_EXCEPTION( exception_value );
565  
566         exception_lineno = 39;
567         goto frame_exception_exit_1;
568     }
569  
570     tmp_args_element_name_1 = var_a;
571  
572     if ( tmp_args_element_name_1 == NULL )
573     {
574  
575         exception_type = PyExc_UnboundLocalError;
576         Py_INCREF( exception_type );
577         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "a" );
578         exception_tb = NULL;
579         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
580         CHAIN_EXCEPTION( exception_value );
581  
582         exception_lineno = 39;
583         goto frame_exception_exit_1;
584     }
585  
586     tmp_args_element_name_2 = var_b;
587  
588     if ( tmp_args_element_name_2 == NULL )
589     {
590  
591         exception_type = PyExc_UnboundLocalError;
592         Py_INCREF( exception_type );
593         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "b" );
594         exception_tb = NULL;
595         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
596         CHAIN_EXCEPTION( exception_value );
597  
598         exception_lineno = 39;
599         goto frame_exception_exit_1;
600     }
601  
602     tmp_args_element_name_3 = var_c;
603  
604     if ( tmp_args_element_name_3 == NULL )
605     {
606  
607         exception_type = PyExc_UnboundLocalError;
608         Py_INCREF( exception_type );
609         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "c" );
610         exception_tb = NULL;
611         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
612         CHAIN_EXCEPTION( exception_value );
613  
614         exception_lineno = 39;
615         goto frame_exception_exit_1;
616     }
617  
618     tmp_args_element_name_4 = var_d;
619  
620     if ( tmp_args_element_name_4 == NULL )
621     {
622  
623         exception_type = PyExc_UnboundLocalError;
624         Py_INCREF( exception_type );
625         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "d" );
626         exception_tb = NULL;
627         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
628         CHAIN_EXCEPTION( exception_value );
629  
630         exception_lineno = 39;
631         goto frame_exception_exit_1;
632     }
633  
634     tmp_args_element_name_5 = var_e;
635  
636     if ( tmp_args_element_name_5 == NULL )
637     {
638  
639         exception_type = PyExc_UnboundLocalError;
640         Py_INCREF( exception_type );
641         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "e" );
642         exception_tb = NULL;
643         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
644         CHAIN_EXCEPTION( exception_value );
645  
646         exception_lineno = 39;
647         goto frame_exception_exit_1;
648     }
649  
650     tmp_args_element_name_6 = var_f;
651  
652     frame_function->f_lineno = 39;
653     {
654         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 };
655         tmp_unused = CALL_FUNCTION_WITH_ARGS6( tmp_called_name_7, call_args );
656     }
657  
658     if ( tmp_unused == NULL )
659     {
660         assert( ERROR_OCCURRED() );
661  
662         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
663  
664  
665         exception_lineno = 39;
666         goto frame_exception_exit_1;
667     }
668     Py_DECREF( tmp_unused );
669     tmp_called_name_8 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func );
670  
671     if (unlikely( tmp_called_name_8 == NULL ))
672     {
673         tmp_called_name_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func );
674     }
675  
676     if ( tmp_called_name_8 == NULL )
677     {
678  
679         exception_type = PyExc_NameError;
680         Py_INCREF( exception_type );
681         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "compiled_func" );
682         exception_tb = NULL;
683         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
684         CHAIN_EXCEPTION( exception_value );
685  
686         exception_lineno = 40;
687         goto frame_exception_exit_1;
688     }
689  
690     tmp_args_element_name_7 = var_a;
691  
692     if ( tmp_args_element_name_7 == NULL )
693     {
694  
695         exception_type = PyExc_UnboundLocalError;
696         Py_INCREF( exception_type );
697         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "a" );
698         exception_tb = NULL;
699         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
700         CHAIN_EXCEPTION( exception_value );
701  
702         exception_lineno = 40;
703         goto frame_exception_exit_1;
704     }
705  
706     tmp_args_element_name_8 = var_c;
707  
708     if ( tmp_args_element_name_8 == NULL )
709     {
710  
711         exception_type = PyExc_UnboundLocalError;
712         Py_INCREF( exception_type );
713         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "c" );
714         exception_tb = NULL;
715         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
716         CHAIN_EXCEPTION( exception_value );
717  
718         exception_lineno = 40;
719         goto frame_exception_exit_1;
720     }
721  
722     tmp_args_element_name_9 = var_b;
723  
724     if ( tmp_args_element_name_9 == NULL )
725     {
726  
727         exception_type = PyExc_UnboundLocalError;
728         Py_INCREF( exception_type );
729         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "b" );
730         exception_tb = NULL;
731         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
732         CHAIN_EXCEPTION( exception_value );
733  
734         exception_lineno = 40;
735         goto frame_exception_exit_1;
736     }
737  
738     tmp_args_element_name_10 = var_d;
739  
740     if ( tmp_args_element_name_10 == NULL )
741     {
742  
743         exception_type = PyExc_UnboundLocalError;
744         Py_INCREF( exception_type );
745         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "d" );
746         exception_tb = NULL;
747         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
748         CHAIN_EXCEPTION( exception_value );
749  
750         exception_lineno = 40;
751         goto frame_exception_exit_1;
752     }
753  
754     tmp_args_element_name_11 = var_e;
755  
756     if ( tmp_args_element_name_11 == NULL )
757     {
758  
759         exception_type = PyExc_UnboundLocalError;
760         Py_INCREF( exception_type );
761         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "e" );
762         exception_tb = NULL;
763         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
764         CHAIN_EXCEPTION( exception_value );
765  
766         exception_lineno = 40;
767         goto frame_exception_exit_1;
768     }
769  
770     tmp_args_element_name_12 = var_f;
771  
772     if ( tmp_args_element_name_12 == NULL )
773     {
774  
775         exception_type = PyExc_UnboundLocalError;
776         Py_INCREF( exception_type );
777         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
778         exception_tb = NULL;
779         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
780         CHAIN_EXCEPTION( exception_value );
781  
782         exception_lineno = 40;
783         goto frame_exception_exit_1;
784     }
785  
786     frame_function->f_lineno = 40;
787     {
788         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 };
789         tmp_unused = CALL_FUNCTION_WITH_ARGS6( tmp_called_name_8, call_args );
790     }
791  
792     if ( tmp_unused == NULL )
793     {
794         assert( ERROR_OCCURRED() );
795  
796         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
797  
798  
799         exception_lineno = 40;
800         goto frame_exception_exit_1;
801     }
802     Py_DECREF( tmp_unused );
803     tmp_called_name_9 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_compiled_func );
804  
805     if (unlikely( tmp_called_name_9 == NULL ))
806     {
807         tmp_called_name_9 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_compiled_func );
808     }
809  
810     if ( tmp_called_name_9 == NULL )
811     {
812  
813         exception_type = PyExc_NameError;
814         Py_INCREF( exception_type );
815         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "compiled_func" );
816         exception_tb = NULL;
817         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
818         CHAIN_EXCEPTION( exception_value );
819  
820         exception_lineno = 41;
821         goto frame_exception_exit_1;
822     }
823  
824     tmp_args_element_name_13 = var_a;
825  
826     if ( tmp_args_element_name_13 == NULL )
827     {
828  
829         exception_type = PyExc_UnboundLocalError;
830         Py_INCREF( exception_type );
831         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "a" );
832         exception_tb = NULL;
833         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
834         CHAIN_EXCEPTION( exception_value );
835  
836         exception_lineno = 41;
837         goto frame_exception_exit_1;
838     }
839  
840     tmp_args_element_name_14 = var_b;
841  
842     if ( tmp_args_element_name_14 == NULL )
843     {
844  
845         exception_type = PyExc_UnboundLocalError;
846         Py_INCREF( exception_type );
847         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "b" );
848         exception_tb = NULL;
849         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
850         CHAIN_EXCEPTION( exception_value );
851  
852         exception_lineno = 41;
853         goto frame_exception_exit_1;
854     }
855  
856     tmp_args_element_name_15 = var_c;
857  
858     if ( tmp_args_element_name_15 == NULL )
859     {
860  
861         exception_type = PyExc_UnboundLocalError;
862         Py_INCREF( exception_type );
863         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "c" );
864         exception_tb = NULL;
865         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
866         CHAIN_EXCEPTION( exception_value );
867  
868         exception_lineno = 41;
869         goto frame_exception_exit_1;
870     }
871  
872     tmp_args_element_name_16 = var_d;
873  
874     if ( tmp_args_element_name_16 == NULL )
875     {
876  
877         exception_type = PyExc_UnboundLocalError;
878         Py_INCREF( exception_type );
879         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "d" );
880         exception_tb = NULL;
881         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
882         CHAIN_EXCEPTION( exception_value );
883  
884         exception_lineno = 41;
885         goto frame_exception_exit_1;
886     }
887  
888     tmp_args_element_name_17 = var_f;
889  
890     if ( tmp_args_element_name_17 == NULL )
891     {
892  
893         exception_type = PyExc_UnboundLocalError;
894         Py_INCREF( exception_type );
895         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "f" );
896         exception_tb = NULL;
897         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
898         CHAIN_EXCEPTION( exception_value );
899  
900         exception_lineno = 41;
901         goto frame_exception_exit_1;
902     }
903  
904     tmp_args_element_name_18 = var_e;
905  
906     if ( tmp_args_element_name_18 == NULL )
907     {
908  
909         exception_type = PyExc_UnboundLocalError;
910         Py_INCREF( exception_type );
911         exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "e" );
912         exception_tb = NULL;
913         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
914         CHAIN_EXCEPTION( exception_value );
915  
916         exception_lineno = 41;
917         goto frame_exception_exit_1;
918     }
919  
920     frame_function->f_lineno = 41;
921     {
922         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 };
923         tmp_unused = CALL_FUNCTION_WITH_ARGS6( tmp_called_name_9, call_args );
924     }
925  
926     if ( tmp_unused == NULL )
927     {
928         assert( ERROR_OCCURRED() );
929  
930         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
931  
932  
933         exception_lineno = 41;
934         goto frame_exception_exit_1;
935     }
936     Py_DECREF( tmp_unused );
937 527
938 #if 0 528 #if 0
939     RESTORE_FRAME_EXCEPTION( frame_function ); 529     RESTORE_FRAME_EXCEPTION( frame_function );
940 #endif 530 #endif
941     // Put the previous frame back on top. 531     // Put the previous frame back on top.
1106     Py_XDECREF( var_d ); 696     Py_XDECREF( var_d );
1107     var_d = NULL; 697     var_d = NULL;
1108 698
1109     Py_XDECREF( var_e ); 699     Py_XDECREF( var_e );
1110     var_e = NULL; 700     var_e = NULL;
t 1111   t
1112     Py_XDECREF( var_f );
1113     var_f = NULL;
1114 701
1115     // Re-raise. 702     // Re-raise.
1116     exception_type = exception_keeper_type_1; 703     exception_type = exception_keeper_type_1;
1117     exception_value = exception_keeper_value_1; 704     exception_value = exception_keeper_value_1;
1118     exception_tb = exception_keeper_tb_1; 705     exception_tb = exception_keeper_tb_1;