Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1721972688.95192307692307257.0CPython 2.78399554242.31730769230768383.57577688250365Nuitka (master)8250065395.6826923076923385.72105095543424Nuitka (develop)8249981549.0480769230769385.72225641551574Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000260000002600000028000000280000003000000030000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3007420988.95192307692307257.0CPython 3.520894957242.31730769230768332.4245735427834Nuitka (master)20745151395.6826923076923333.65550757359006Nuitka (develop)20745471549.0480769230769333.652878180309Nuitka (factory)Construct RichComparisonConditionStringsTicks

Source Code with Construct

module_value1 = "1000"
module_value2 = "2000"

import sys
loop_count = 50000 if len(sys.argv) < 2 else int(sys.argv[1])

x = 0
import itertools
for _x in itertools.repeat(None, loop_count):
    x += 1
    y = x % 2 == 0

# construct_begin
    if x % 2 == 0:
# construct_alternative


        y = not y

print("OK.")

Source Code without Construct

module_value1 = "1000"
module_value2 = "2000"

import sys
loop_count = 50000 if len(sys.argv) < 2 else int(sys.argv[1])

x = 0
import itertools
for _x in itertools.repeat(None, loop_count):
    x += 1
    y = x % 2 == 0

# construct_begin

# construct_alternative
    if y:
# construct_end
        y = not y

print("OK.")

Context Diff of Source Code


Construct
Baseline
28 for _x in itertools.repeat(None, loop_count): 28 for _x in itertools.repeat(None, loop_count):
29     x += 1 29     x += 1
30     y = x % 2 == 0 30     y = x % 2 == 0
31 31
32 # construct_begin 32 # construct_begin
n 33     if x % 2 == 0: n 33  
34 # construct_alternative 34 # construct_alternative
t 35   t 35     if y:
36   36 # construct_end
37         y = not y 37         y = not y
38 38
39 print("OK.") 39 print("OK.")
40 40

Context Diff of Generated Code


Construct
Baseline
813     } 813     }
814     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14 ); 814     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14 );
815     } 815     }
816     { 816     {
817     nuitka_bool tmp_condition_result_2; 817     nuitka_bool tmp_condition_result_2;
n 818     PyObject *tmp_compexpr_left_3; n
819     PyObject *tmp_compexpr_right_3;
820     PyObject *tmp_left_name_3;
821     PyObject *tmp_mvar_value_7; 818     PyObject *tmp_mvar_value_7;
n 822     PyObject *tmp_right_name_3; n 819     int tmp_truth_name_1;
823     tmp_mvar_value_7 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_x ); 820     tmp_mvar_value_7 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y );
824 821
825     if (unlikely( tmp_mvar_value_7 == NULL )) 822     if (unlikely( tmp_mvar_value_7 == NULL ))
826     { 823     {
n 827         tmp_mvar_value_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_x ); n 824         tmp_mvar_value_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
828     }
829  
830     if ( tmp_mvar_value_7 == NULL )
831     { 825     }
832 826
n 833         exception_type = PyExc_NameError; n 827     CHECK_OBJECT( tmp_mvar_value_7 );
834         Py_INCREF( exception_type ); 828     tmp_truth_name_1 = CHECK_IF_TRUE( tmp_mvar_value_7 );
835         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "x" ); 829     if ( tmp_truth_name_1 == -1 )
836         exception_tb = NULL; 830     {
831         assert( ERROR_OCCURRED() );
832  
837         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 833         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
838         CHAIN_EXCEPTION( exception_value );
839 834
n n 835  
840         exception_lineno = 33; 836         exception_lineno = 35;
841 837
842         goto try_except_handler_1; 838         goto try_except_handler_1;
843     } 839     }
n 844   n
845     tmp_left_name_3 = tmp_mvar_value_7;
846     tmp_right_name_3 = const_int_pos_2;
847     tmp_compexpr_left_3 = BINARY_OPERATION_REMAINDER( tmp_left_name_3, tmp_right_name_3 );
848     if ( tmp_compexpr_left_3 == NULL )
849     {
850         assert( ERROR_OCCURRED() );
851  
852         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
853  
854  
855         exception_lineno = 33;
856  
857         goto try_except_handler_1;
858     }
859     tmp_compexpr_right_3 = const_int_0;
860     tmp_res = RICH_COMPARE_BOOL_EQ_NORECURSE( tmp_compexpr_left_3, tmp_compexpr_right_3 );
861     Py_DECREF( tmp_compexpr_left_3 );
862     if ( tmp_res == -1 )
863     {
864         assert( ERROR_OCCURRED() );
865  
866         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
867  
868  
869         exception_lineno = 33;
870  
871         goto try_except_handler_1;
872     }
873     tmp_condition_result_2 = ( tmp_res != 0 ) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE; 840     tmp_condition_result_2 = tmp_truth_name_1 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
874     if ( tmp_condition_result_2 == NUITKA_BOOL_TRUE ) 841     if ( tmp_condition_result_2 == NUITKA_BOOL_TRUE )
875     { 842     {
876         goto branch_yes_1; 843         goto branch_yes_1;
877     } 844     }
878     else 845     else
889     if (unlikely( tmp_mvar_value_8 == NULL )) 856     if (unlikely( tmp_mvar_value_8 == NULL ))
890     { 857     {
891         tmp_mvar_value_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y ); 858         tmp_mvar_value_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
892     } 859     }
893 860
t 894     if ( tmp_mvar_value_8 == NULL ) t 861     CHECK_OBJECT( tmp_mvar_value_8 );
895     {
896  
897         exception_type = PyExc_NameError;
898         Py_INCREF( exception_type );
899         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "y" );
900         exception_tb = NULL;
901         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
902         CHAIN_EXCEPTION( exception_value );
903  
904         exception_lineno = 37;
905  
906         goto try_except_handler_1;
907     }
908  
909     tmp_operand_name_1 = tmp_mvar_value_8; 862     tmp_operand_name_1 = tmp_mvar_value_8;
910     tmp_res = CHECK_IF_TRUE( tmp_operand_name_1 ); 863     tmp_res = CHECK_IF_TRUE( tmp_operand_name_1 );
911     if ( tmp_res == -1 ) 864     if ( tmp_res == -1 )
912     { 865     {
913         assert( ERROR_OCCURRED() ); 866         assert( ERROR_OCCURRED() );