Construct RichComparisonConditionStrings

Performance Diagrams

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