Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1721972688.95192307692307257.0CPython 2.78399362242.31730769230768383.5785322198328Nuitka (master)8300700395.6826923076923384.9944024884377Nuitka (develop)8299602549.0480769230769385.010159573789Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000260000002600000028000000280000003000000030000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3007420988.95192307692307257.0CPython 3.520891209242.31730769230768332.45537031158744Nuitka (master)20565305395.6826923076923335.13327589865355Nuitka (develop)20566762549.0480769230769335.12130394237084Nuitka (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
804     } 804     }
805     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14 ); 805     UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14 );
806     } 806     }
807     { 807     {
808     nuitka_bool tmp_condition_result_2; 808     nuitka_bool tmp_condition_result_2;
n 809     PyObject *tmp_compexpr_left_3; n
810     PyObject *tmp_compexpr_right_3;
811     PyObject *tmp_left_name_3;
812     PyObject *tmp_mvar_value_7; 809     PyObject *tmp_mvar_value_7;
n 813     PyObject *tmp_right_name_3; n 810     int tmp_truth_name_1;
814     tmp_mvar_value_7 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_x ); 811     tmp_mvar_value_7 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y );
815 812
816     if (unlikely( tmp_mvar_value_7 == NULL )) 813     if (unlikely( tmp_mvar_value_7 == NULL ))
817     { 814     {
n 818         tmp_mvar_value_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_x ); n 815         tmp_mvar_value_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
819     }
820  
821     if ( tmp_mvar_value_7 == NULL )
822     { 816     }
823 817
n 824         exception_type = PyExc_NameError; n 818     CHECK_OBJECT( tmp_mvar_value_7 );
825         Py_INCREF( exception_type ); 819     tmp_truth_name_1 = CHECK_IF_TRUE( tmp_mvar_value_7 );
826         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "x" ); 820     if ( tmp_truth_name_1 == -1 )
827         exception_tb = NULL; 821     {
822         assert( ERROR_OCCURRED() );
823  
828         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 824         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
829         CHAIN_EXCEPTION( exception_value );
830 825
n n 826  
831         exception_lineno = 33; 827         exception_lineno = 35;
832 828
833         goto try_except_handler_1; 829         goto try_except_handler_1;
834     } 830     }
n 835   n
836     tmp_left_name_3 = tmp_mvar_value_7;
837     tmp_right_name_3 = const_int_pos_2;
838     tmp_compexpr_left_3 = BINARY_OPERATION_REMAINDER( tmp_left_name_3, tmp_right_name_3 );
839     if ( tmp_compexpr_left_3 == NULL )
840     {
841         assert( ERROR_OCCURRED() );
842  
843         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
844  
845  
846         exception_lineno = 33;
847  
848         goto try_except_handler_1;
849     }
850     tmp_compexpr_right_3 = const_int_0;
851     tmp_res = RICH_COMPARE_BOOL_EQ_OBJECT_OBJECT_NORECURSE( tmp_compexpr_left_3, tmp_compexpr_right_3 );
852     Py_DECREF( tmp_compexpr_left_3 );
853     if ( tmp_res == -1 )
854     {
855         assert( ERROR_OCCURRED() );
856  
857         FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
858  
859  
860         exception_lineno = 33;
861  
862         goto try_except_handler_1;
863     }
864     tmp_condition_result_2 = ( tmp_res != 0 ) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE; 831     tmp_condition_result_2 = tmp_truth_name_1 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
865     if ( tmp_condition_result_2 == NUITKA_BOOL_TRUE ) 832     if ( tmp_condition_result_2 == NUITKA_BOOL_TRUE )
866     { 833     {
867         goto branch_yes_1; 834         goto branch_yes_1;
868     } 835     }
869     else 836     else
880     if (unlikely( tmp_mvar_value_8 == NULL )) 847     if (unlikely( tmp_mvar_value_8 == NULL ))
881     { 848     {
882         tmp_mvar_value_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y ); 849         tmp_mvar_value_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
883     } 850     }
884 851
t 885     if ( tmp_mvar_value_8 == NULL ) t 852     CHECK_OBJECT( tmp_mvar_value_8 );
886     {
887  
888         exception_type = PyExc_NameError;
889         Py_INCREF( exception_type );
890         exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "y" );
891         exception_tb = NULL;
892         NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
893         CHAIN_EXCEPTION( exception_value );
894  
895         exception_lineno = 37;
896  
897         goto try_except_handler_1;
898     }
899  
900     tmp_operand_name_1 = tmp_mvar_value_8; 853     tmp_operand_name_1 = tmp_mvar_value_8;
901     tmp_res = CHECK_IF_TRUE( tmp_operand_name_1 ); 854     tmp_res = CHECK_IF_TRUE( tmp_operand_name_1 );
902     if ( tmp_res == -1 ) 855     if ( tmp_res == -1 )
903     { 856     {
904         assert( ERROR_OCCURRED() ); 857         assert( ERROR_OCCURRED() );