Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)1453966188.95192307692307257.0CPython 3.106450043242.31730769230768394.4907615426205Nuitka (main)6450043395.6826923076923394.4907615426205Nuitka (develop)6450043549.0480769230769394.4907615426205Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)1551201088.95192307692307257.0CPython 3.86524735242.31730769230768400.1725429695591Nuitka (main)6524735395.6826923076923400.1725429695591Nuitka (develop)6524735549.0480769230769400.1725429695591Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)1230900788.95192307692307257.0CPython 2.72749742242.31730769230768448.9116178189991Nuitka (main)2749738395.6826923076923448.91169812292117Nuitka (develop)2749738549.0480769230769448.91169812292117Nuitka (factory)Construct RichComparisonConditionStringsTicks

Source Code with Construct

import itertools
import sys

module_value1 = "1000"
module_value2 = "2000"

loop_count = 50000 if len(sys.argv) < 2 else int(sys.argv[1])

x = 0
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

import itertools
import sys

module_value1 = "1000"
module_value2 = "2000"

loop_count = 50000 if len(sys.argv) < 2 else int(sys.argv[1])

x = 0
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
29 for _x in itertools.repeat(None, loop_count): 29 for _x in itertools.repeat(None, loop_count):
30     x += 1 30     x += 1
31     y = x % 2 == 0 31     y = x % 2 == 0
32 32
33 # construct_begin 33 # construct_begin
n 34     if x % 2 == 0: n 34  
35 # construct_alternative 35 # construct_alternative
t 36   t 36     if y:
37   37 # construct_end
38         y = not y 38         y = not y
39 39
40 print("OK.") 40 print("OK.")
41 41

Context Diff of Generated Code


Construct
Baseline
819         } 819         }
820         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[18], tmp_assign_source_13); 820         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[18], tmp_assign_source_13);
821     } 821     }
822     { 822     {
823         nuitka_bool tmp_condition_result_2; 823         nuitka_bool tmp_condition_result_2;
n 824         PyObject *tmp_cmp_expr_left_3; n 824         PyObject *tmp_mvar_value_1;
825         PyObject *tmp_cmp_expr_right_3; 825         int tmp_truth_name_1;
826         PyObject *tmp_mod_expr_left_2;
827         PyObject *tmp_mod_expr_right_2;
828         tmp_mod_expr_left_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[15]); 826         tmp_mvar_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[18]);
829 827
n 830         if (unlikely(tmp_mod_expr_left_2 == NULL)) { n 828         if (unlikely(tmp_mvar_value_1 == NULL)) {
831             tmp_mod_expr_left_2 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[15]); 829             tmp_mvar_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[18]);
832         } 830         }
833 831
n 834         if (tmp_mod_expr_left_2 == NULL) { n 832         assert(!(tmp_mvar_value_1 == NULL));
833         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_mvar_value_1);
834         if (tmp_truth_name_1 == -1) {
835             assert(HAS_ERROR_OCCURRED(tstate)); 835             assert(HAS_ERROR_OCCURRED(tstate));
836 836
837             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); 837             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
838 838
839 839
n 840             exception_lineno = 34; n 840             exception_lineno = 36;
841 841
842             goto try_except_handler_1; 842             goto try_except_handler_1;
843         } 843         }
n 844         tmp_mod_expr_right_2 = mod_consts[10]; n 844         tmp_condition_result_2 = tmp_truth_name_1 == 0 ? NUITKA_BOOL_FALSE : NUITKA_BOOL_TRUE;
845         tmp_cmp_expr_left_3 = BINARY_OPERATION_MOD_OBJECT_OBJECT_INT(tmp_mod_expr_left_2, tmp_mod_expr_right_2);
846         if (tmp_cmp_expr_left_3 == NULL) {
847             assert(HAS_ERROR_OCCURRED(tstate));
848  
849             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
850  
851  
852             exception_lineno = 34;
853  
854             goto try_except_handler_1;
855         }
856         tmp_cmp_expr_right_3 = mod_consts[14];
857         tmp_condition_result_2 = RICH_COMPARE_EQ_NBOOL_OBJECT_INT(tmp_cmp_expr_left_3, tmp_cmp_expr_right_3);
858         Py_DECREF(tmp_cmp_expr_left_3);
859         if (tmp_condition_result_2 == NUITKA_BOOL_EXCEPTION) {
860             assert(HAS_ERROR_OCCURRED(tstate));
861  
862             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
863  
864  
865             exception_lineno = 34;
866  
867             goto try_except_handler_1;
868         }
869         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) { 845         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) {
870             goto branch_yes_1; 846             goto branch_yes_1;
871         } else { 847         } else {
872             goto branch_no_1; 848             goto branch_no_1;
873         } 849         }
880 856
881         if (unlikely(tmp_operand_value_1 == NULL)) { 857         if (unlikely(tmp_operand_value_1 == NULL)) {
882             tmp_operand_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[18]); 858             tmp_operand_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[18]);
883         } 859         }
884 860
t 885         if (tmp_operand_value_1 == NULL) { t 861         assert(!(tmp_operand_value_1 == NULL));
886             assert(HAS_ERROR_OCCURRED(tstate));
887  
888             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
889  
890  
891             exception_lineno = 38;
892  
893             goto try_except_handler_1;
894         }
895         tmp_res = CHECK_IF_TRUE(tmp_operand_value_1); 862         tmp_res = CHECK_IF_TRUE(tmp_operand_value_1);
896         if (tmp_res == -1) { 863         if (tmp_res == -1) {
897             assert(HAS_ERROR_OCCURRED(tstate)); 864             assert(HAS_ERROR_OCCURRED(tstate));
898 865
899             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); 866             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);