Construct RichComparisonConditionStrings

Performance Diagrams

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