Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)1208278988.95192307692307257.0CPython 2.72924462242.31730769230768444.3047273306239Nuitka (main)2924453395.6826923076923444.3049113972712Nuitka (develop)2924453549.0480769230769444.3049113972712Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)1538664588.95192307692307257.0CPython 3.85824483242.31730769230768410.57196714323464Nuitka (main)5824483395.6826923076923410.57196714323464Nuitka (develop)5824483549.0480769230769410.57196714323464Nuitka (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
819         } 819         }
820         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[20], tmp_assign_source_15); 820         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[20], tmp_assign_source_15);
821     } 821     }
822     { 822     {
823         nuitka_bool tmp_condition_result_2; 823         nuitka_bool tmp_condition_result_2;
n 824         PyObject *tmp_compexpr_left_3; n
825         PyObject *tmp_compexpr_right_3;
826         PyObject *tmp_left_value_3;
827         PyObject *tmp_right_value_3; 824         PyObject *tmp_mvar_value_1;
825         int tmp_truth_name_1;
828         tmp_left_value_3 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[16]); 826         tmp_mvar_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[20]);
829 827
n 830         if (unlikely(tmp_left_value_3 == NULL)) { n 828         if (unlikely(tmp_mvar_value_1 == NULL)) {
831             tmp_left_value_3 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[16]); 829             tmp_mvar_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[20]);
832         } 830         }
833 831
n 834         if (tmp_left_value_3 == 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(ERROR_OCCURRED()); 835             assert(ERROR_OCCURRED());
836 836
837             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 837             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
838 838
839 839
n 840             exception_lineno = 33; n 840             exception_lineno = 35;
841 841
842             goto try_except_handler_1; 842             goto try_except_handler_1;
843         } 843         }
n 844         tmp_right_value_3 = mod_consts[11]; n 844         tmp_condition_result_2 = tmp_truth_name_1 == 0 ? NUITKA_BOOL_FALSE : NUITKA_BOOL_TRUE;
845         tmp_compexpr_left_3 = BINARY_OPERATION_MOD_OBJECT_OBJECT_LONG(tmp_left_value_3, tmp_right_value_3);
846         if (tmp_compexpr_left_3 == NULL) {
847             assert(ERROR_OCCURRED());
848  
849             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
850  
851  
852             exception_lineno = 33;
853  
854             goto try_except_handler_1;
855         }
856         tmp_compexpr_right_3 = mod_consts[15];
857         tmp_condition_result_2 = RICH_COMPARE_EQ_NBOOL_OBJECT_LONG(tmp_compexpr_left_3, tmp_compexpr_right_3);
858         Py_DECREF(tmp_compexpr_left_3);
859         if (tmp_condition_result_2 == NUITKA_BOOL_EXCEPTION) {
860             assert(ERROR_OCCURRED());
861  
862             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
863  
864  
865             exception_lineno = 33;
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         }
n 874         assert(tmp_condition_result_2 != NUITKA_BOOL_UNASSIGNED); n
875     } 850     }
876     branch_yes_1:; 851     branch_yes_1:;
877     { 852     {
878         PyObject *tmp_assign_source_16; 853         PyObject *tmp_assign_source_16;
879         PyObject *tmp_operand_value_1; 854         PyObject *tmp_operand_value_1;
881 856
882         if (unlikely(tmp_operand_value_1 == NULL)) { 857         if (unlikely(tmp_operand_value_1 == NULL)) {
883             tmp_operand_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[20]); 858             tmp_operand_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[20]);
884         } 859         }
885 860
t 886         if (tmp_operand_value_1 == NULL) { t 861         assert(!(tmp_operand_value_1 == NULL));
887             assert(ERROR_OCCURRED());
888  
889             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
890  
891  
892             exception_lineno = 37;
893  
894             goto try_except_handler_1;
895         }
896         tmp_res = CHECK_IF_TRUE(tmp_operand_value_1); 862         tmp_res = CHECK_IF_TRUE(tmp_operand_value_1);
897         if (tmp_res == -1) { 863         if (tmp_res == -1) {
898             assert(ERROR_OCCURRED()); 864             assert(ERROR_OCCURRED());
899 865
900             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 866             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);