Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1208263588.95192307692307257.0CPython 2.74725000242.31730769230768407.4791631034634Nuitka (master)4725000395.6826923076923407.4791631034634Nuitka (develop)4725000549.0480769230769407.4791631034634Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000220000002200000024000000240000002600000026000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2799360088.95192307692307257.0CPython 3.519428524242.31730769230768332.60878379343853Nuitka (master)19428468395.6826923076923332.6092781372006Nuitka (develop)19428478549.0480769230769332.60918986152876Nuitka (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 static bool constants_created = false; 63 static bool constants_created = false;
64 64
65 /* Function to create module private constants. */ 65 /* Function to create module private constants. */
66 static void createModuleConstants(void) { 66 static void createModuleConstants(void) {
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_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 103 ], 9, 1); n 68     const_str_plain_itertools = UNSTREAM_STRING_ASCII(&constant_bin[ 80 ], 9, 1);
69     const_str_plain_sys = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 3, 1); 69     const_str_plain_sys = UNSTREAM_STRING_ASCII(&constant_bin[ 6 ], 3, 1);
70     const_str_plain_y = UNSTREAM_STRING_ASCII(&constant_bin[ 7 ], 1, 1); 70     const_str_plain_y = UNSTREAM_STRING_ASCII(&constant_bin[ 7 ], 1, 1);
71     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul); 71     const_int_pos_50000 = PyLong_FromUnsignedLong(50000ul);
n 72     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII(&constant_bin[ 112 ], 13, 1); n 72     const_str_plain_module_value2 = UNSTREAM_STRING_ASCII(&constant_bin[ 89 ], 13, 1);
73     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII(&constant_bin[ 125 ], 13, 1); 73     const_str_plain_module_value1 = UNSTREAM_STRING_ASCII(&constant_bin[ 102 ], 13, 1);
74     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 138 ], 8, 0); 74     const_str_angle_module = UNSTREAM_STRING_ASCII(&constant_bin[ 115 ], 8, 0);
75     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 63 ], 1, 1); 75     const_str_plain_x = UNSTREAM_STRING_ASCII(&constant_bin[ 63 ], 1, 1);
n 76     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 146 ], 3, 0); n 76     const_str_digest_5ed1392909ad16e6227b8230f4582352 = UNSTREAM_STRING_ASCII(&constant_bin[ 123 ], 3, 0);
77     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 149 ], 6, 1); 77     const_str_plain_repeat = UNSTREAM_STRING_ASCII(&constant_bin[ 126 ], 6, 1);
78     const_int_pos_2 = PyLong_FromUnsignedLong(2ul); 78     const_int_pos_2 = PyLong_FromUnsignedLong(2ul);
n 79     const_str_plain__x = UNSTREAM_STRING_ASCII(&constant_bin[ 155 ], 2, 1); n 79     const_str_plain__x = UNSTREAM_STRING_ASCII(&constant_bin[ 132 ], 2, 1);
80     const_str_plain_1000 = UNSTREAM_STRING_ASCII(&constant_bin[ 157 ], 4, 0); 80     const_str_plain_1000 = UNSTREAM_STRING_ASCII(&constant_bin[ 134 ], 4, 0);
81     const_str_plain_argv = UNSTREAM_STRING_ASCII(&constant_bin[ 161 ], 4, 1); 81     const_str_plain_argv = UNSTREAM_STRING_ASCII(&constant_bin[ 138 ], 4, 1);
82     const_str_plain_2000 = UNSTREAM_STRING_ASCII(&constant_bin[ 165 ], 4, 0); 82     const_str_plain_2000 = UNSTREAM_STRING_ASCII(&constant_bin[ 142 ], 4, 0);
83     const_str_digest_dd336b577a52bdf209973688d089221e = UNSTREAM_STRING_ASCII(&constant_bin[ 169 ], 55, 0); 83     const_str_digest_dd336b577a52bdf209973688d089221e = UNSTREAM_STRING_ASCII(&constant_bin[ 146 ], 55, 0);
84 84
85     constants_created = true; 85     constants_created = true;
86 } 86 }
87 87
88 /* Function to verify module private constants for non-corruption. */ 88 /* Function to verify module private constants for non-corruption. */
903         } 903         }
904         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14); 904         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)const_str_plain_y, tmp_assign_source_14);
905     } 905     }
906     { 906     {
907         nuitka_bool tmp_condition_result_2; 907         nuitka_bool tmp_condition_result_2;
n 908         PyObject *tmp_compexpr_left_3; n
909         PyObject *tmp_compexpr_right_3;
910         PyObject *tmp_left_name_3;
911         PyObject *tmp_mvar_value_7; 908         PyObject *tmp_mvar_value_7;
n 912         PyObject *tmp_right_name_3; n
913         PyObject *tmp_tmp_condition_result_2_object_1;
914         int tmp_truth_name_2; 909         int tmp_truth_name_2;
n 915         tmp_mvar_value_7 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_x); n 910         tmp_mvar_value_7 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)const_str_plain_y);
916 911
917         if (unlikely(tmp_mvar_value_7 == NULL)) { 912         if (unlikely(tmp_mvar_value_7 == NULL)) {
n 918             tmp_mvar_value_7 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_x); n 913             tmp_mvar_value_7 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_y);
919         } 914         }
920 915
n 921         if (tmp_mvar_value_7 == NULL) { n 916         CHECK_OBJECT(tmp_mvar_value_7);
917         tmp_truth_name_2 = CHECK_IF_TRUE(tmp_mvar_value_7);
918         if (tmp_truth_name_2 == -1) {
919             assert(ERROR_OCCURRED());
922 920
n 923             exception_type = PyExc_NameError; n
924             Py_INCREF(exception_type);
925             exception_value = UNSTREAM_STRING(&constant_bin[ 57 ], 23, 0);
926             exception_tb = NULL;
927             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 921             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
928             CHAIN_EXCEPTION(exception_value);
929 922
n n 923  
930             exception_lineno = 33; 924             exception_lineno = 35;
931 925
932             goto try_except_handler_1; 926             goto try_except_handler_1;
933         } 927         }
n 934   n
935         tmp_left_name_3 = tmp_mvar_value_7;
936         tmp_right_name_3 = const_int_pos_2;
937         tmp_compexpr_left_3 = BINARY_OPERATION_MOD_OBJECT_OBJECT_LONG(tmp_left_name_3, tmp_right_name_3);
938         if (tmp_compexpr_left_3 == NULL) {
939             assert(ERROR_OCCURRED());
940  
941             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
942  
943  
944             exception_lineno = 33;
945  
946             goto try_except_handler_1;
947         }
948         tmp_compexpr_right_3 = const_int_0;
949         tmp_tmp_condition_result_2_object_1 = RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(tmp_compexpr_left_3, tmp_compexpr_right_3);
950         Py_DECREF(tmp_compexpr_left_3);
951         if (tmp_tmp_condition_result_2_object_1 == NULL) {
952             assert(ERROR_OCCURRED());
953  
954             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
955  
956  
957             exception_lineno = 33;
958  
959             goto try_except_handler_1;
960         }
961         tmp_truth_name_2 = CHECK_IF_TRUE(tmp_tmp_condition_result_2_object_1);
962         if (tmp_truth_name_2 == -1) {
963             assert(ERROR_OCCURRED());
964  
965             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
966             Py_DECREF(tmp_tmp_condition_result_2_object_1);
967  
968             exception_lineno = 33;
969  
970             goto try_except_handler_1;
971         }
972         tmp_condition_result_2 = tmp_truth_name_2 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE; 928         tmp_condition_result_2 = tmp_truth_name_2 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
n 973         Py_DECREF(tmp_tmp_condition_result_2_object_1); n
974         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) { 929         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) {
975             goto branch_yes_1; 930             goto branch_yes_1;
976         } else { 931         } else {
977             goto branch_no_1; 932             goto branch_no_1;
978         } 933         }
986 941
987         if (unlikely(tmp_mvar_value_8 == NULL)) { 942         if (unlikely(tmp_mvar_value_8 == NULL)) {
988             tmp_mvar_value_8 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_y); 943             tmp_mvar_value_8 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)const_str_plain_y);
989         } 944         }
990 945
t 991         if (tmp_mvar_value_8 == NULL) { t 946         CHECK_OBJECT(tmp_mvar_value_8);
992  
993             exception_type = PyExc_NameError;
994             Py_INCREF(exception_type);
995             exception_value = UNSTREAM_STRING(&constant_bin[ 80 ], 23, 0);
996             exception_tb = NULL;
997             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
998             CHAIN_EXCEPTION(exception_value);
999  
1000             exception_lineno = 37;
1001  
1002             goto try_except_handler_1;
1003         }
1004  
1005         tmp_operand_name_1 = tmp_mvar_value_8; 947         tmp_operand_name_1 = tmp_mvar_value_8;
1006         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1); 948         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1);
1007         if (tmp_res == -1) { 949         if (tmp_res == -1) {
1008             assert(ERROR_OCCURRED()); 950             assert(ERROR_OCCURRED());
1009 951