Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1731773688.95192307692307257.0CPython 2.78250034242.31730769230768386.3915479083231Nuitka (master)8250022395.6826923076923386.39171914228905Nuitka (develop)8250046549.0480769230769386.3913766743573Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000260000002600000028000000280000003000000030000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3027639188.95192307692307257.0CPython 3.520572336242.31730769230768336.2043306500384Nuitka (master)20570766395.6826923076923336.2171449631395Nuitka (develop)20573632549.0480769230769336.19375272024286Nuitka (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
824         } 824         }
825         UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14 ); 825         UPDATE_STRING_DICT1( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14 );
826     } 826     }
827     { 827     {
828         nuitka_bool tmp_condition_result_2; 828         nuitka_bool tmp_condition_result_2;
n 829         PyObject *tmp_compexpr_left_3; n
830         PyObject *tmp_compexpr_right_3;
831         PyObject *tmp_left_name_3;
832         PyObject *tmp_mvar_value_7; 829         PyObject *tmp_mvar_value_7;
n 833         PyObject *tmp_right_name_3; n 830         int tmp_truth_name_1;
834         tmp_mvar_value_7 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_x ); 831         tmp_mvar_value_7 = GET_STRING_DICT_VALUE( moduledict___main__, (Nuitka_StringObject *)const_str_plain_y );
835 832
836         if (unlikely( tmp_mvar_value_7 == NULL )) 833         if (unlikely( tmp_mvar_value_7 == NULL ))
837         { 834         {
n 838             tmp_mvar_value_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_x ); n 835             tmp_mvar_value_7 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
839         }
840  
841         if ( tmp_mvar_value_7 == NULL )
842         { 836         }
843 837
n 844             exception_type = PyExc_NameError; n 838         CHECK_OBJECT( tmp_mvar_value_7 );
845             Py_INCREF( exception_type ); 839         tmp_truth_name_1 = CHECK_IF_TRUE( tmp_mvar_value_7 );
846             exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "x" ); 840         if ( tmp_truth_name_1 == -1 )
847             exception_tb = NULL; 841         {
842             assert( ERROR_OCCURRED() );
843  
848             NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); 844             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
849             CHAIN_EXCEPTION( exception_value );
850 845
n n 846  
851             exception_lineno = 33; 847             exception_lineno = 35;
852 848
853             goto try_except_handler_1; 849             goto try_except_handler_1;
854         } 850         }
n 855   n
856         tmp_left_name_3 = tmp_mvar_value_7;
857         tmp_right_name_3 = const_int_pos_2;
858         tmp_compexpr_left_3 = BINARY_OPERATION_REMAINDER( tmp_left_name_3, tmp_right_name_3 );
859         if ( tmp_compexpr_left_3 == NULL )
860         {
861             assert( ERROR_OCCURRED() );
862  
863             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
864  
865  
866             exception_lineno = 33;
867  
868             goto try_except_handler_1;
869         }
870         tmp_compexpr_right_3 = const_int_0;
871         tmp_res = RICH_COMPARE_BOOL_EQ_OBJECT_OBJECT_NORECURSE( tmp_compexpr_left_3, tmp_compexpr_right_3 );
872         Py_DECREF( tmp_compexpr_left_3 );
873         if ( tmp_res == -1 )
874         {
875             assert( ERROR_OCCURRED() );
876  
877             FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb );
878  
879  
880             exception_lineno = 33;
881  
882             goto try_except_handler_1;
883         }
884         tmp_condition_result_2 = ( tmp_res != 0 ) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE; 851         tmp_condition_result_2 = tmp_truth_name_1 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
885         if ( tmp_condition_result_2 == NUITKA_BOOL_TRUE ) 852         if ( tmp_condition_result_2 == NUITKA_BOOL_TRUE )
886         { 853         {
887             goto branch_yes_1; 854             goto branch_yes_1;
888         } 855         }
889         else 856         else
900             if (unlikely( tmp_mvar_value_8 == NULL )) 867             if (unlikely( tmp_mvar_value_8 == NULL ))
901             { 868             {
902                 tmp_mvar_value_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y ); 869                 tmp_mvar_value_8 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_y );
903             } 870             }
904 871
t 905             if ( tmp_mvar_value_8 == NULL ) t 872             CHECK_OBJECT( tmp_mvar_value_8 );
906             {
907  
908                 exception_type = PyExc_NameError;
909                 Py_INCREF( exception_type );
910                 exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "y" );
911                 exception_tb = NULL;
912                 NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb );
913                 CHAIN_EXCEPTION( exception_value );
914  
915                 exception_lineno = 37;
916  
917                 goto try_except_handler_1;
918             }
919  
920             tmp_operand_name_1 = tmp_mvar_value_8; 873             tmp_operand_name_1 = tmp_mvar_value_8;
921             tmp_res = CHECK_IF_TRUE( tmp_operand_name_1 ); 874             tmp_res = CHECK_IF_TRUE( tmp_operand_name_1 );
922             if ( tmp_res == -1 ) 875             if ( tmp_res == -1 )
923             { 876             {
924                 assert( ERROR_OCCURRED() ); 877                 assert( ERROR_OCCURRED() );