Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1208278988.95192307692307257.0CPython 2.72949451242.31730769230768443.79365605840735Nuitka (master)2949447395.6826923076923443.7937378658062Nuitka (develop)2949447549.0480769230769443.7937378658062Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)1538664588.95192307692307257.0CPython 3.87224742242.31730769230768388.08327377660703Nuitka (master)7224742395.6826923076923388.08327377660703Nuitka (develop)7224742549.0480769230769388.08327377660703Nuitka (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
818         } 818         }
819         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[20], tmp_assign_source_15); 819         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[20], tmp_assign_source_15);
820     } 820     }
821     { 821     {
822         nuitka_bool tmp_condition_result_2; 822         nuitka_bool tmp_condition_result_2;
n 823         PyObject *tmp_compexpr_left_3; n
824         PyObject *tmp_compexpr_right_3;
825         PyObject *tmp_left_name_3;
826         PyObject *tmp_right_name_3; 823         PyObject *tmp_mvar_value_1;
827         PyObject *tmp_tmp_condition_result_2_object_1;
828         int tmp_truth_name_1; 824         int tmp_truth_name_1;
n 829         tmp_left_name_3 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[16]); n 825         tmp_mvar_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[20]);
830 826
n 831         if (unlikely(tmp_left_name_3 == NULL)) { n 827         if (unlikely(tmp_mvar_value_1 == NULL)) {
832             tmp_left_name_3 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[16]); 828             tmp_mvar_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[20]);
833         } 829         }
834 830
n n 831         assert(!(tmp_mvar_value_1 == NULL));
832         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_mvar_value_1);
835         if (tmp_left_name_3 == NULL) { 833         if (tmp_truth_name_1 == -1) {
836             assert(ERROR_OCCURRED()); 834             assert(ERROR_OCCURRED());
837 835
838             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 836             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
839 837
840 838
n 841             exception_lineno = 33; n 839             exception_lineno = 35;
842 840
843             goto try_except_handler_1; 841             goto try_except_handler_1;
844         } 842         }
n 845         tmp_right_name_3 = mod_consts[11]; n
846         tmp_compexpr_left_3 = BINARY_OPERATION_MOD_OBJECT_OBJECT_LONG(tmp_left_name_3, tmp_right_name_3);
847         if (tmp_compexpr_left_3 == NULL) {
848             assert(ERROR_OCCURRED());
849  
850             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
851  
852  
853             exception_lineno = 33;
854  
855             goto try_except_handler_1;
856         }
857         tmp_compexpr_right_3 = mod_consts[15];
858         tmp_tmp_condition_result_2_object_1 = RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(tmp_compexpr_left_3, tmp_compexpr_right_3);
859         Py_DECREF(tmp_compexpr_left_3);
860         if (tmp_tmp_condition_result_2_object_1 == NULL) {
861             assert(ERROR_OCCURRED());
862  
863             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
864  
865  
866             exception_lineno = 33;
867  
868             goto try_except_handler_1;
869         }
870         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_tmp_condition_result_2_object_1);
871         if (tmp_truth_name_1 == -1) {
872             assert(ERROR_OCCURRED());
873  
874             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
875             Py_DECREF(tmp_tmp_condition_result_2_object_1);
876  
877             exception_lineno = 33;
878  
879             goto try_except_handler_1;
880         }
881         tmp_condition_result_2 = tmp_truth_name_1 == 0 ? NUITKA_BOOL_FALSE : NUITKA_BOOL_TRUE; 843         tmp_condition_result_2 = tmp_truth_name_1 == 0 ? NUITKA_BOOL_FALSE : NUITKA_BOOL_TRUE;
n 882         Py_DECREF(tmp_tmp_condition_result_2_object_1); n
883         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) { 844         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) {
884             goto branch_yes_1; 845             goto branch_yes_1;
885         } else { 846         } else {
886             goto branch_no_1; 847             goto branch_no_1;
887         } 848         }
894 855
895         if (unlikely(tmp_operand_name_1 == NULL)) { 856         if (unlikely(tmp_operand_name_1 == NULL)) {
896             tmp_operand_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[20]); 857             tmp_operand_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[20]);
897         } 858         }
898 859
t 899         if (tmp_operand_name_1 == NULL) { t 860         assert(!(tmp_operand_name_1 == NULL));
900             assert(ERROR_OCCURRED());
901  
902             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
903  
904  
905             exception_lineno = 37;
906  
907             goto try_except_handler_1;
908         }
909         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1); 861         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1);
910         if (tmp_res == -1) { 862         if (tmp_res == -1) {
911             assert(ERROR_OCCURRED()); 863             assert(ERROR_OCCURRED());
912 864
913             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 865             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);