Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1208263588.95192307692307257.0CPython 2.74725000242.31730769230768407.4791631034634Nuitka (master)4725000395.6826923076923407.4791631034634Nuitka (develop)4674999549.0480769230769408.50178907421844Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000220000002200000024000000240000002600000026000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2799351088.95192307692307257.0CPython 3.519428524242.31730769230768332.60823239441515Nuitka (master)19428580395.6826923076923332.60773804906376Nuitka (develop)19378417549.0480769230769333.05055672519484Nuitka (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
843         } 843         }
844         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[19], tmp_assign_source_14); 844         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[19], tmp_assign_source_14);
845     } 845     }
846     { 846     {
847         nuitka_bool tmp_condition_result_2; 847         nuitka_bool tmp_condition_result_2;
n 848         PyObject *tmp_compexpr_left_3; n
849         PyObject *tmp_compexpr_right_3;
850         PyObject *tmp_left_name_3;
851         PyObject *tmp_mvar_value_7; 848         PyObject *tmp_mvar_value_7;
n 852         PyObject *tmp_right_name_3; n
853         PyObject *tmp_tmp_condition_result_2_object_1;
854         int tmp_truth_name_2; 849         int tmp_truth_name_2;
n 855         tmp_mvar_value_7 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[15]); n 850         tmp_mvar_value_7 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[19]);
856 851
857         if (unlikely(tmp_mvar_value_7 == NULL)) { 852         if (unlikely(tmp_mvar_value_7 == NULL)) {
n 858             tmp_mvar_value_7 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[15]); n 853             tmp_mvar_value_7 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[19]);
859         } 854         }
860 855
n 861         if (unlikely(tmp_mvar_value_7 == NULL)) { n 856         CHECK_OBJECT(tmp_mvar_value_7);
857         tmp_truth_name_2 = CHECK_IF_TRUE(tmp_mvar_value_7);
858         if (tmp_truth_name_2 == -1) {
859             assert(ERROR_OCCURRED());
862 860
n 863             FORMAT_NAME_ERROR(&exception_type, &exception_value, mod_consts[15]); n
864             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb); 861             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
865             CHAIN_EXCEPTION(exception_value);
866 862
n n 863  
867             exception_lineno = 33; 864             exception_lineno = 35;
868 865
869             goto try_except_handler_1; 866             goto try_except_handler_1;
870         } 867         }
n 871   n
872         tmp_left_name_3 = tmp_mvar_value_7;
873         tmp_right_name_3 = mod_consts[11];
874         tmp_compexpr_left_3 = BINARY_OPERATION_MOD_OBJECT_OBJECT_LONG(tmp_left_name_3, tmp_right_name_3);
875         if (tmp_compexpr_left_3 == NULL) {
876             assert(ERROR_OCCURRED());
877  
878             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
879  
880  
881             exception_lineno = 33;
882  
883             goto try_except_handler_1;
884         }
885         tmp_compexpr_right_3 = mod_consts[9];
886         tmp_tmp_condition_result_2_object_1 = RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(tmp_compexpr_left_3, tmp_compexpr_right_3);
887         Py_DECREF(tmp_compexpr_left_3);
888         if (tmp_tmp_condition_result_2_object_1 == NULL) {
889             assert(ERROR_OCCURRED());
890  
891             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
892  
893  
894             exception_lineno = 33;
895  
896             goto try_except_handler_1;
897         }
898         tmp_truth_name_2 = CHECK_IF_TRUE(tmp_tmp_condition_result_2_object_1);
899         if (tmp_truth_name_2 == -1) {
900             assert(ERROR_OCCURRED());
901  
902             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
903             Py_DECREF(tmp_tmp_condition_result_2_object_1);
904  
905             exception_lineno = 33;
906  
907             goto try_except_handler_1;
908         }
909         tmp_condition_result_2 = tmp_truth_name_2 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE; 868         tmp_condition_result_2 = tmp_truth_name_2 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
n 910         Py_DECREF(tmp_tmp_condition_result_2_object_1); n
911         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) { 869         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) {
912             goto branch_yes_1; 870             goto branch_yes_1;
913         } else { 871         } else {
914             goto branch_no_1; 872             goto branch_no_1;
915         } 873         }
923 881
924         if (unlikely(tmp_mvar_value_8 == NULL)) { 882         if (unlikely(tmp_mvar_value_8 == NULL)) {
925             tmp_mvar_value_8 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[19]); 883             tmp_mvar_value_8 = GET_STRING_DICT_VALUE(dict_builtin, (Nuitka_StringObject *)mod_consts[19]);
926         } 884         }
927 885
t 928         if (unlikely(tmp_mvar_value_8 == NULL)) { t 886         CHECK_OBJECT(tmp_mvar_value_8);
929  
930             FORMAT_NAME_ERROR(&exception_type, &exception_value, mod_consts[19]);
931             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
932             CHAIN_EXCEPTION(exception_value);
933  
934             exception_lineno = 37;
935  
936             goto try_except_handler_1;
937         }
938  
939         tmp_operand_name_1 = tmp_mvar_value_8; 887         tmp_operand_name_1 = tmp_mvar_value_8;
940         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1); 888         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1);
941         if (tmp_res == -1) { 889         if (tmp_res == -1) {
942             assert(ERROR_OCCURRED()); 890             assert(ERROR_OCCURRED());
943 891