Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1208267588.95192307692307257.0CPython 2.74749999242.31730769230768406.9682024055104Nuitka (master)4749999395.6826923076923406.9682024055104Nuitka (develop)4749999549.0480769230769406.9682024055104Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000220000002200000024000000240000002600000026000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2799348488.95192307692307257.0CPython 3.519428152242.31730769230768332.6113569693026Nuitka (master)19428410395.6826923076923332.6090794475325Nuitka (develop)19428410549.0480769230769332.6090794475325Nuitka (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
830         } 830         }
831         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[19], tmp_assign_source_14); 831         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[19], tmp_assign_source_14);
832     } 832     }
833     { 833     {
834         nuitka_bool tmp_condition_result_2; 834         nuitka_bool tmp_condition_result_2;
n 835         PyObject *tmp_compexpr_left_3; n
836         PyObject *tmp_compexpr_right_3;
837         PyObject *tmp_left_name_3;
838         PyObject *tmp_right_name_3; 835         PyObject *tmp_mvar_value_1;
839         PyObject *tmp_tmp_condition_result_2_object_1;
840         int tmp_truth_name_1; 836         int tmp_truth_name_1;
n 841         tmp_left_name_3 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[15]); n 837         tmp_mvar_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[19]);
842 838
n 843         if (unlikely(tmp_left_name_3 == NULL)) { n 839         if (unlikely(tmp_mvar_value_1 == NULL)) {
844             tmp_left_name_3 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[15]); 840             tmp_mvar_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[19]);
845         } 841         }
846 842
n n 843         assert(!(tmp_mvar_value_1 == NULL));
844         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_mvar_value_1);
847         if (tmp_left_name_3 == NULL) { 845         if (tmp_truth_name_1 == -1) {
848             assert(ERROR_OCCURRED()); 846             assert(ERROR_OCCURRED());
849 847
850             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 848             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
851 849
852 850
n 853             exception_lineno = 33; n 851             exception_lineno = 35;
854 852
855             goto try_except_handler_1; 853             goto try_except_handler_1;
856         } 854         }
n 857         tmp_right_name_3 = mod_consts[10]; n
858         tmp_compexpr_left_3 = BINARY_OPERATION_MOD_OBJECT_OBJECT_LONG(tmp_left_name_3, tmp_right_name_3);
859         if (tmp_compexpr_left_3 == NULL) {
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         tmp_compexpr_right_3 = mod_consts[14];
870         tmp_tmp_condition_result_2_object_1 = RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(tmp_compexpr_left_3, tmp_compexpr_right_3);
871         Py_DECREF(tmp_compexpr_left_3);
872         if (tmp_tmp_condition_result_2_object_1 == NULL) {
873             assert(ERROR_OCCURRED());
874  
875             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
876  
877  
878             exception_lineno = 33;
879  
880             goto try_except_handler_1;
881         }
882         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_tmp_condition_result_2_object_1);
883         if (tmp_truth_name_1 == -1) {
884             assert(ERROR_OCCURRED());
885  
886             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
887             Py_DECREF(tmp_tmp_condition_result_2_object_1);
888  
889             exception_lineno = 33;
890  
891             goto try_except_handler_1;
892         }
893         tmp_condition_result_2 = tmp_truth_name_1 == 0 ? NUITKA_BOOL_FALSE : NUITKA_BOOL_TRUE; 855         tmp_condition_result_2 = tmp_truth_name_1 == 0 ? NUITKA_BOOL_FALSE : NUITKA_BOOL_TRUE;
n 894         Py_DECREF(tmp_tmp_condition_result_2_object_1); n
895         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) { 856         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) {
896             goto branch_yes_1; 857             goto branch_yes_1;
897         } else { 858         } else {
898             goto branch_no_1; 859             goto branch_no_1;
899         } 860         }
906 867
907         if (unlikely(tmp_operand_name_1 == NULL)) { 868         if (unlikely(tmp_operand_name_1 == NULL)) {
908             tmp_operand_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[19]); 869             tmp_operand_name_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(mod_consts[19]);
909         } 870         }
910 871
t 911         if (tmp_operand_name_1 == NULL) { t 872         assert(!(tmp_operand_name_1 == NULL));
912             assert(ERROR_OCCURRED());
913  
914             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
915  
916  
917             exception_lineno = 37;
918  
919             goto try_except_handler_1;
920         }
921         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1); 873         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1);
922         if (tmp_res == -1) { 874         if (tmp_res == -1) {
923             assert(ERROR_OCCURRED()); 875             assert(ERROR_OCCURRED());
924 876
925             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 877             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);