Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 0010000001000000200000020000003000000300000040000004000000500000050000006000000600000070000007000000800000080000009000000900000010000000100000001100000011000000120000001200000013000000130000001400000014000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)1453848788.95192307692307257.0CPython 3.106449897242.31730769230768394.484390834215Nuitka (main)6449938395.6826923076923394.4836939439011Nuitka (develop)6450072549.0480769230769394.48141630238734Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000130000001300000014000000140000001500000015000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)1551205088.95192307692307257.0CPython 3.86524594242.31730769230768400.17505720738694Nuitka (main)6524644395.6826923076923400.1742606802206Nuitka (develop)6524796549.0480769230769400.17183923763486Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)1230915088.95192307692307257.0CPython 2.72749742242.31730769230768448.9122591418079Nuitka (main)2749540395.6826923076923448.9163144427582Nuitka (develop)2749738549.0480769230769448.912339444797Nuitka (factory)Construct RichComparisonConditionStringsTicks

Source Code with Construct

        y = not y

print("OK.")

#     Python test originally created or extracted from other peoples work. The
#     parts from me are licensed as below. It is at least Free Software where
#     it's copied from other people. In these cases, that will normally be
#     indicated.
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.

Source Code without Construct

    if y:
# construct_end
        y = not y

print("OK.")

#     Python test originally created or extracted from other peoples work. The
#     parts from me are licensed as below. It is at least Free Software where
#     it's copied from other people. In these cases, that will normally be
#     indicated.
#
#     Licensed under the Apache License, Version 2.0 (the "License");
#     you may not use this file except in compliance with the License.
#     You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#     Unless required by applicable law or agreed to in writing, software
#     distributed under the License is distributed on an "AS IS" BASIS,
#     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#     See the License for the specific language governing permissions and
#     limitations under the License.

Context Diff of Source Code


Construct
Baseline
13 for _x in itertools.repeat(None, loop_count): 13 for _x in itertools.repeat(None, loop_count):
14     x += 1 14     x += 1
15     y = x % 2 == 0 15     y = x % 2 == 0
16 16
17 # construct_begin 17 # construct_begin
n 18     if x % 2 == 0: n 18  
19 # construct_alternative 19 # construct_alternative
t 20   t 20     if y:
21   21 # construct_end
22         y = not y 22         y = not y
23 23
24 print("OK.") 24 print("OK.")
25 25
26 #     Python test originally created or extracted from other peoples work. The 26 #     Python test originally created or extracted from other peoples work. The

Context Diff of Generated Code


Construct
Baseline
822         } 822         }
823         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[18], tmp_assign_source_13); 823         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[18], tmp_assign_source_13);
824     } 824     }
825     { 825     {
826         nuitka_bool tmp_condition_result_2; 826         nuitka_bool tmp_condition_result_2;
n 827         PyObject *tmp_cmp_expr_left_3; n 827         PyObject *tmp_mvar_value_1;
828         PyObject *tmp_cmp_expr_right_3; 828         int tmp_truth_name_1;
829         PyObject *tmp_mod_expr_left_2;
830         PyObject *tmp_mod_expr_right_2;
831         tmp_mod_expr_left_2 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[15]); 829         tmp_mvar_value_1 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[18]);
832 830
n 833         if (unlikely(tmp_mod_expr_left_2 == NULL)) { n 831         if (unlikely(tmp_mvar_value_1 == NULL)) {
834             tmp_mod_expr_left_2 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[15]); 832             tmp_mvar_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[18]);
835         } 833         }
836 834
n 837         if (tmp_mod_expr_left_2 == NULL) { n 835         assert(!(tmp_mvar_value_1 == NULL));
836         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_mvar_value_1);
837         if (tmp_truth_name_1 == -1) {
838             assert(HAS_ERROR_OCCURRED(tstate)); 838             assert(HAS_ERROR_OCCURRED(tstate));
839 839
840             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); 840             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
841 841
842 842
n 843             exception_lineno = 18; n 843             exception_lineno = 20;
844 844
845             goto try_except_handler_1; 845             goto try_except_handler_1;
846         } 846         }
n 847         tmp_mod_expr_right_2 = mod_consts[10]; n 847         tmp_condition_result_2 = tmp_truth_name_1 == 0 ? NUITKA_BOOL_FALSE : NUITKA_BOOL_TRUE;
848         tmp_cmp_expr_left_3 = BINARY_OPERATION_MOD_OBJECT_OBJECT_INT(tmp_mod_expr_left_2, tmp_mod_expr_right_2);
849         if (tmp_cmp_expr_left_3 == NULL) {
850             assert(HAS_ERROR_OCCURRED(tstate));
851  
852             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
853  
854  
855             exception_lineno = 18;
856  
857             goto try_except_handler_1;
858         }
859         tmp_cmp_expr_right_3 = mod_consts[14];
860         tmp_condition_result_2 = RICH_COMPARE_EQ_NBOOL_OBJECT_INT(tmp_cmp_expr_left_3, tmp_cmp_expr_right_3);
861         Py_DECREF(tmp_cmp_expr_left_3);
862         if (tmp_condition_result_2 == NUITKA_BOOL_EXCEPTION) {
863             assert(HAS_ERROR_OCCURRED(tstate));
864  
865             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
866  
867  
868             exception_lineno = 18;
869  
870             goto try_except_handler_1;
871         }
872         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) { 848         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) {
873             goto branch_yes_1; 849             goto branch_yes_1;
874         } else { 850         } else {
875             goto branch_no_1; 851             goto branch_no_1;
876         } 852         }
883 859
884         if (unlikely(tmp_operand_value_1 == NULL)) { 860         if (unlikely(tmp_operand_value_1 == NULL)) {
885             tmp_operand_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[18]); 861             tmp_operand_value_1 = GET_MODULE_VARIABLE_VALUE_FALLBACK(tstate, mod_consts[18]);
886         } 862         }
887 863
t 888         if (tmp_operand_value_1 == NULL) { t 864         assert(!(tmp_operand_value_1 == NULL));
889             assert(HAS_ERROR_OCCURRED(tstate));
890  
891             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
892  
893  
894             exception_lineno = 22;
895  
896             goto try_except_handler_1;
897         }
898         tmp_res = CHECK_IF_TRUE(tmp_operand_value_1); 865         tmp_res = CHECK_IF_TRUE(tmp_operand_value_1);
899         if (tmp_res == -1) { 866         if (tmp_res == -1) {
900             assert(HAS_ERROR_OCCURRED(tstate)); 867             assert(HAS_ERROR_OCCURRED(tstate));
901 868
902             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); 869             FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);