Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1606965988.95192307692307257.0CPython 2.79100000242.31730769230768364.1777543271502Nuitka (master)7999695395.6826923076923381.09798227157825Nuitka (develop)7999987549.0480769230769381.09349196519975Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000260000002600000028000000280000003000000030000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)3014371788.95192307692307257.0CPython 3.521631375242.31730769230768326.7833869428807Nuitka (master)21134889395.6826923076923330.8535329320484Nuitka (develop)21130632549.0480769230769330.88843142158464Nuitka (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
63 63
64 /* Function to create module private constants. */ 64 /* Function to create module private constants. */
65 static void createModuleConstants( void ) 65 static void createModuleConstants( void )
66 { 66 {
67     const_str_plain_loop_count = UNSTREAM_STRING_ASCII(&constant_bin[ 31 ], 10, 1); 67     const_str_plain_loop_count = UNSTREAM_STRING_ASCII(&constant_bin[ 31 ], 10, 1);
n 68     const_str_digest_2fa8373cd54688de41ffbd14dd265934 = UNSTREAM_STRING_ASCII(&constant_bin[ 103 ], 55, 0); n 68     const_str_digest_2fa8373cd54688de41ffbd14dd265934 = UNSTREAM_STRING_ASCII(&constant_bin[ 80 ], 55, 0);
69     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 158 ], 9, 1); 69     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 135 ], 9, 1);
70     const_str_plain_sys = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 3, 1); 70     const_str_plain_sys = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 3, 1);
71     const_str_plain_y = UNSTREAM_STRING_ASCII(&constant_bin[ 7 ], 1, 1); 71     const_str_plain_y = UNSTREAM_STRING_ASCII(&constant_bin[ 7 ], 1, 1);
72     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul); 72     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
n 73     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII(&constant_bin[ 167 ], 13, 1); n 73     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII(&constant_bin[ 144 ], 13, 1);
74     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1); 74     const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple = PyTuple_New(1);
n 75     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 180 ], 3, 0); n 75     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 157 ], 3, 0);
76     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352); 76     PyTuple_SET_ITEM(const_tuple_str_digest_5ed1392909ad16e6227b8230f4582352_tuple, 0, const_str_digest_5ed1392909ad16e6227b8230f4582352); Py_INCREF(const_str_digest_5ed1392909ad16e6227b8230f4582352);
n 77     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII(&constant_bin[ 183 ], 13, 1); n 77     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII(&constant_bin[ 160 ], 13, 1);
78     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 196 ], 8, 0); 78     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 173 ], 8, 0);
79     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 63 ], 1, 1); 79     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 63 ], 1, 1);
n 80     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 204 ], 6, 1); n 80     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 181 ], 6, 1);
81     const_int_pos_2 = PyLong_FromUnsignedLong(2ul); 81     const_int_pos_2 = PyLong_FromUnsignedLong(2ul);
n 82     const_str_plain__x = UNSTREAM_STRING_ASCII(&constant_bin[ 210 ], 2, 1); n 82     const_str_plain__x = UNSTREAM_STRING_ASCII(&constant_bin[ 187 ], 2, 1);
83     const_str_plain_1000 = UNSTREAM_STRING_ASCII(&constant_bin[ 212 ], 4, 0); 83     const_str_plain_1000 = UNSTREAM_STRING_ASCII(&constant_bin[ 189 ], 4, 0);
84     const_str_plain_argv = UNSTREAM_STRING_ASCII(&constant_bin[ 216 ], 4, 1); 84     const_str_plain_argv = UNSTREAM_STRING_ASCII(&constant_bin[ 193 ], 4, 1);
85     const_str_plain_2000 = UNSTREAM_STRING_ASCII(&constant_bin[ 220 ], 4, 0); 85     const_str_plain_2000 = UNSTREAM_STRING_ASCII(&constant_bin[ 197 ], 4, 0);
86 86
87     constants_created = true; 87     constants_created = true;
88 } 88 }
89 89
90 /* Function to verify module private constants for non-corruption. */ 90 /* Function to verify module private constants for non-corruption. */
799         } 799         }
800         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14); 800         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14);
801     } 801     }
802     { 802     {
803         nuitka_bool tmp_condition_result_2; 803         nuitka_bool tmp_condition_result_2;
n 804         PyObject *tmp_compexpr_left_3; n
805         PyObject *tmp_compexpr_right_3;
806         PyObject *tmp_left_name_3;
807         PyObject *tmp_mvar_value_7; 804         PyObject *tmp_mvar_value_7;
n 808         PyObject *tmp_right_name_3; n 805         int tmp_truth_name_1;
809         tmp_mvar_value_7 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_x); 806         tmp_mvar_value_7 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_y);
810 807
811         if (unlikely(tmp_mvar_value_7 == NULL)) { 808         if (unlikely(tmp_mvar_value_7 == NULL)) {
n 812             tmp_mvar_value_7 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_x); n 809             tmp_mvar_value_7 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_y);
813         } 810         }
814 811
n 815         if (tmp_mvar_value_7 == NULL) { n 812         CHECK_OBJECT(tmp_mvar_value_7);
813         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_mvar_value_7);
814         if (tmp_truth_name_1 == -1) {
815             assert(ERROR_OCCURRED());
816 816
n 817             exception_type = PyExc_NameError; n
818             Py_INCREF(exception_type);
819             exception_value = UNSTREAM_STRING(&constant_bin[ 57 ], 23, 0);
820             exception_tb = NULL;
821             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 817             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
822             CHAIN_EXCEPTION(exception_value);
823 818
n n 819  
824             exception_lineno = 33; 820             exception_lineno = 35;
825 821
826             goto try_except_handler_1; 822             goto try_except_handler_1;
827         } 823         }
n 828   n
829         tmp_left_name_3 = tmp_mvar_value_7;
830         tmp_right_name_3 = const_int_pos_2;
831         tmp_compexpr_left_3 = BINARY_OPERATION_MOD_OBJECT_LONG(tmp_left_name_3, tmp_right_name_3);
832         if (tmp_compexpr_left_3 == NULL) {
833             assert(ERROR_OCCURRED());
834  
835             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
836  
837  
838             exception_lineno = 33;
839  
840             goto try_except_handler_1;
841         }
842         tmp_compexpr_right_3 = const_int_0;
843         tmp_res = RICH_COMPARE_BOOL_EQ_OBJECT_OBJECT_NORECURSE(tmp_compexpr_left_3, tmp_compexpr_right_3);
844         Py_DECREF(tmp_compexpr_left_3);
845         if (tmp_res == -1) {
846             assert(ERROR_OCCURRED());
847  
848             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
849  
850  
851             exception_lineno = 33;
852  
853             goto try_except_handler_1;
854         }
855         tmp_condition_result_2 = (tmp_res != 0) ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE; 824         tmp_condition_result_2 = tmp_truth_name_1 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
856         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) { 825         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) {
857             goto branch_yes_1; 826             goto branch_yes_1;
858         } else { 827         } else {
859             goto branch_no_1; 828             goto branch_no_1;
860         } 829         }
867 836
868             if (unlikely(tmp_mvar_value_8 == NULL)) { 837             if (unlikely(tmp_mvar_value_8 == NULL)) {
869                 tmp_mvar_value_8 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_y); 838                 tmp_mvar_value_8 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_y);
870             } 839             }
871 840
t 872             if (tmp_mvar_value_8 == NULL) { t 841             CHECK_OBJECT(tmp_mvar_value_8);
873  
874                 exception_type = PyExc_NameError;
875                 Py_INCREF(exception_type);
876                 exception_value = UNSTREAM_STRING(&constant_bin[ 80 ], 23, 0);
877                 exception_tb = NULL;
878                 NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
879                 CHAIN_EXCEPTION(exception_value);
880  
881                 exception_lineno = 37;
882  
883                 goto try_except_handler_1;
884             }
885  
886             tmp_operand_name_1 = tmp_mvar_value_8; 842             tmp_operand_name_1 = tmp_mvar_value_8;
887             tmp_res = CHECK_IF_TRUE(tmp_operand_name_1); 843             tmp_res = CHECK_IF_TRUE(tmp_operand_name_1);
888             if (tmp_res == -1) { 844             if (tmp_res == -1) {
889                 assert(ERROR_OCCURRED()); 845                 assert(ERROR_OCCURRED());
890 846