Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1208278988.95192307692307257.0CPython 2.73699999242.31730769230768428.44356116787276Nuitka (master)3699999395.6826923076923428.44356116787276Nuitka (develop)3699999549.0480769230769428.44356116787276Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)1538664588.95192307692307257.0CPython 3.87149996242.31730769230768389.28372303233897Nuitka (master)7149996395.6826923076923389.28372303233897Nuitka (develop)7149996549.0480769230769389.28372303233897Nuitka (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
808         } 808         }
809         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[20], tmp_assign_source_15); 809         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[20], tmp_assign_source_15);
810     } 810     }
811     { 811     {
812         nuitka_bool tmp_condition_result_2; 812         nuitka_bool tmp_condition_result_2;
n 813         PyObject *tmp_compexpr_left_3; n
814         PyObject *tmp_compexpr_right_3;
815         PyObject *tmp_left_name_3;
816         PyObject *tmp_right_name_3; 813         PyObject *tmp_mvar_value_1;
817         PyObject *tmp_tmp_condition_result_2_object_1;
818         int tmp_truth_name_1; 814         int tmp_truth_name_1;
n 819         tmp_left_name_3 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[16]); n 815         tmp_mvar_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[20]);
820 816
n 821         if (unlikely(tmp_left_name_3 == NULL)) { n 817         if (unlikely(tmp_mvar_value_1 == NULL)) {
822             tmp_left_name_3 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[16]); 818             tmp_mvar_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[20]);
823         } 819         }
824 820
n n 821         assert(!(tmp_mvar_value_1 == NULL));
822         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_mvar_value_1);
825         if (tmp_left_name_3 == NULL) { 823         if (tmp_truth_name_1 == -1) {
826             assert(ERROR_OCCURRED()); 824             assert(ERROR_OCCURRED());
827 825
828             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 826             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
829 827
830 828
n 831             exception_lineno = 33; n 829             exception_lineno = 35;
832 830
833             goto try_except_handler_1; 831             goto try_except_handler_1;
834         } 832         }
n 835         tmp_right_name_3 = mod_consts[11]; n
836         tmp_compexpr_left_3 = BINARY_OPERATION_MOD_OBJECT_OBJECT_LONG(tmp_left_name_3, tmp_right_name_3);
837         if (tmp_compexpr_left_3 == NULL) {
838             assert(ERROR_OCCURRED());
839  
840             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
841  
842  
843             exception_lineno = 33;
844  
845             goto try_except_handler_1;
846         }
847         tmp_compexpr_right_3 = mod_consts[15];
848         tmp_tmp_condition_result_2_object_1 = RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(tmp_compexpr_left_3, tmp_compexpr_right_3);
849         Py_DECREF(tmp_compexpr_left_3);
850         if (tmp_tmp_condition_result_2_object_1 == NULL) {
851             assert(ERROR_OCCURRED());
852  
853             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
854  
855  
856             exception_lineno = 33;
857  
858             goto try_except_handler_1;
859         }
860         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_tmp_condition_result_2_object_1);
861         if (tmp_truth_name_1 == -1) {
862             assert(ERROR_OCCURRED());
863  
864             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
865             Py_DECREF(tmp_tmp_condition_result_2_object_1);
866  
867             exception_lineno = 33;
868  
869             goto try_except_handler_1;
870         }
871         tmp_condition_result_2 = tmp_truth_name_1 == 0 ? NUITKA_BOOL_FALSE : NUITKA_BOOL_TRUE; 833         tmp_condition_result_2 = tmp_truth_name_1 == 0 ? NUITKA_BOOL_FALSE : NUITKA_BOOL_TRUE;
n 872         Py_DECREF(tmp_tmp_condition_result_2_object_1); n
873         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) { 834         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) {
874             goto branch_yes_1; 835             goto branch_yes_1;
875         } else { 836         } else {
876             goto branch_no_1; 837             goto branch_no_1;
877         } 838         }
884 845
885         if (unlikely(tmp_operand_name_1 == NULL)) { 846         if (unlikely(tmp_operand_name_1 == NULL)) {
886             tmp_operand_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[20]); 847             tmp_operand_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[20]);
887         } 848         }
888 849
t 889         if (tmp_operand_name_1 == NULL) { t 850         assert(!(tmp_operand_name_1 == NULL));
890             assert(ERROR_OCCURRED());
891  
892             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
893  
894  
895             exception_lineno = 37;
896  
897             goto try_except_handler_1;
898         }
899         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1); 851         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1);
900         if (tmp_res == -1) { 852         if (tmp_res == -1) {
901             assert(ERROR_OCCURRED()); 853             assert(ERROR_OCCURRED());
902 854
903             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 855             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);