Construct RichComparisonConditionStrings

Performance Diagrams

Construct RichComparisonConditionStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1208263588.95192307692307257.0CPython 2.74674999242.31730769230768408.50178907421844Nuitka (master)4900000395.6826923076923403.90004378820703Nuitka (develop)4900000549.0480769230769403.90004378820703Nuitka (factory)Construct RichComparisonConditionStringsTicks Construct RichComparisonConditionStrings 0020000002000000400000040000006000000600000080000008000000100000001000000012000000120000001400000014000000160000001600000018000000180000002000000020000000220000002200000024000000240000002600000026000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)2799348488.95192307692307257.0CPython 3.519378417242.31730769230768333.0503978423088Nuitka (master)19628410395.6826923076923330.8435586955219Nuitka (develop)19628410549.0480769230769330.8435586955219Nuitka (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
795         } 795         }
796         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[19], tmp_assign_source_14); 796         UPDATE_STRING_DICT1(moduledict___main__, (Nuitka_StringObject *)mod_consts[19], tmp_assign_source_14);
797     } 797     }
798     { 798     {
799         nuitka_bool tmp_condition_result_2; 799         nuitka_bool tmp_condition_result_2;
n 800         PyObject *tmp_compexpr_left_3; n
801         PyObject *tmp_compexpr_right_3;
802         PyObject *tmp_left_name_3;
803         PyObject *tmp_right_name_3; 800         PyObject *tmp_mvar_value_1;
804         PyObject *tmp_tmp_condition_result_2_object_1;
805         int tmp_truth_name_1; 801         int tmp_truth_name_1;
n 806         tmp_left_name_3 = GET_MODULE_VARIABLE_VALUE(moduledict___main__, mod_consts[15]); n 802         tmp_mvar_value_1 = GET_MODULE_VARIABLE_VALUE(moduledict___main__, mod_consts[19]);
803         assert(!(tmp_mvar_value_1 == NULL));
804         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_mvar_value_1);
807         if (tmp_left_name_3 == NULL) { 805         if (tmp_truth_name_1 == -1) {
808             assert(ERROR_OCCURRED()); 806             assert(ERROR_OCCURRED());
809 807
810             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 808             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
811 809
812 810
n 813             exception_lineno = 33; n 811             exception_lineno = 35;
814 812
815             goto try_except_handler_1; 813             goto try_except_handler_1;
816         } 814         }
n 817         tmp_right_name_3 = mod_consts[11]; n
818         tmp_compexpr_left_3 = BINARY_OPERATION_MOD_OBJECT_OBJECT_LONG(tmp_left_name_3, tmp_right_name_3);
819         if (tmp_compexpr_left_3 == NULL) {
820             assert(ERROR_OCCURRED());
821  
822             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
823  
824  
825             exception_lineno = 33;
826  
827             goto try_except_handler_1;
828         }
829         tmp_compexpr_right_3 = mod_consts[9];
830         tmp_tmp_condition_result_2_object_1 = RICH_COMPARE_EQ_OBJECT_OBJECT_OBJECT(tmp_compexpr_left_3, tmp_compexpr_right_3);
831         Py_DECREF(tmp_compexpr_left_3);
832         if (tmp_tmp_condition_result_2_object_1 == NULL) {
833             assert(ERROR_OCCURRED());
834  
835             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
836  
837  
838             exception_lineno = 33;
839  
840             goto try_except_handler_1;
841         }
842         tmp_truth_name_1 = CHECK_IF_TRUE(tmp_tmp_condition_result_2_object_1);
843         if (tmp_truth_name_1 == -1) {
844             assert(ERROR_OCCURRED());
845  
846             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
847             Py_DECREF(tmp_tmp_condition_result_2_object_1);
848  
849             exception_lineno = 33;
850  
851             goto try_except_handler_1;
852         }
853         tmp_condition_result_2 = tmp_truth_name_1 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE; 815         tmp_condition_result_2 = tmp_truth_name_1 == 1 ? NUITKA_BOOL_TRUE : NUITKA_BOOL_FALSE;
n 854         Py_DECREF(tmp_tmp_condition_result_2_object_1); n
855         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) { 816         if (tmp_condition_result_2 == NUITKA_BOOL_TRUE) {
856             goto branch_yes_1; 817             goto branch_yes_1;
857         } else { 818         } else {
858             goto branch_no_1; 819             goto branch_no_1;
859         } 820         }
861     branch_yes_1:; 822     branch_yes_1:;
862     { 823     {
863         PyObject *tmp_assign_source_15; 824         PyObject *tmp_assign_source_15;
864         PyObject *tmp_operand_name_1; 825         PyObject *tmp_operand_name_1;
865         tmp_operand_name_1 = GET_MODULE_VARIABLE_VALUE(moduledict___main__, mod_consts[19]); 826         tmp_operand_name_1 = GET_MODULE_VARIABLE_VALUE(moduledict___main__, mod_consts[19]);
t 866         if (tmp_operand_name_1 == NULL) { t 827         assert(!(tmp_operand_name_1 == NULL));
867             assert(ERROR_OCCURRED());
868  
869             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
870  
871  
872             exception_lineno = 37;
873  
874             goto try_except_handler_1;
875         }
876         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1); 828         tmp_res = CHECK_IF_TRUE(tmp_operand_name_1);
877         if (tmp_res == -1) { 829         if (tmp_res == -1) {
878             assert(ERROR_OCCURRED()); 830             assert(ERROR_OCCURRED());
879 831
880             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 832             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);