Construct RichComparisonStrings

Performance Diagrams

Construct RichComparisonStrings 001000000100000020000002000000300000030000004000000400000050000005000000600000060000007000000700000080000008000000900000090000001000000010000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1073635788.95192307692307257.0CPython 2.73500001242.31730769230768423.5569518742574Nuitka (master)3500001395.6826923076923423.5569518742574Nuitka (develop)3500001549.0480769230769423.5569518742574Nuitka (factory)Construct RichComparisonStringsTicks Construct RichComparisonStrings 00100000010000002000000200000030000003000000400000040000005000000500000060000006000000700000070000008000000800000090000009000000100000001000000011000000110000001200000012000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)1253019388.95192307692307257.0CPython 3.87050000242.31730769230768365.07814380525014Nuitka (master)7050000395.6826923076923365.07814380525014Nuitka (develop)7050000549.0480769230769365.07814380525014Nuitka (factory)Construct RichComparisonStringsTicks

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])

def calledRepeatedly(value1, value2):
    # Force frame and eliminate forward propagation (currently).
    module_value1

# construct_begin
    if value1 == value2:
        return
# construct_end

    return value1, value2


import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly(module_value1, module_value2)

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])

def calledRepeatedly(value1, value2):
    # Force frame and eliminate forward propagation (currently).
    module_value1

# construct_begin




    return value1, value2


import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly(module_value1, module_value2)

print("OK.")

Context Diff of Source Code


Construct
Baseline
26 def calledRepeatedly(value1, value2): 26 def calledRepeatedly(value1, value2):
27     # Force frame and eliminate forward propagation (currently). 27     # Force frame and eliminate forward propagation (currently).
28     module_value1 28     module_value1
29 29
30 # construct_begin 30 # construct_begin
t 31     if value1 == value2: t 31  
32         return 32  
33 # construct_end 33  
34 34
35     return value1, value2 35     return value1, value2
36 36
37 37
38 import itertools 38 import itertools

Context Diff of Generated Code


Construct
Baseline
108     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; 108     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused;
109     PyObject *exception_type = NULL; 109     PyObject *exception_type = NULL;
110     PyObject *exception_value = NULL; 110     PyObject *exception_value = NULL;
111     PyTracebackObject *exception_tb = NULL; 111     PyTracebackObject *exception_tb = NULL;
112     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 112     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n n 113     static struct Nuitka_FrameObject *cache_frame_689719963472296c0b70d49934c42f45 = NULL;
113     PyObject *tmp_return_value = NULL; 114     PyObject *tmp_return_value = NULL;
n 114     static struct Nuitka_FrameObject *cache_frame_689719963472296c0b70d49934c42f45 = NULL; n
115 115
116     // Actual function body. 116     // Actual function body.
117     if (isFrameUnusable(cache_frame_689719963472296c0b70d49934c42f45)) { 117     if (isFrameUnusable(cache_frame_689719963472296c0b70d49934c42f45)) {
118         Py_XDECREF(cache_frame_689719963472296c0b70d49934c42f45); 118         Py_XDECREF(cache_frame_689719963472296c0b70d49934c42f45);
119 119
158             exception_lineno = 28; 158             exception_lineno = 28;
159             type_description_1 = "oo"; 159             type_description_1 = "oo";
160             goto frame_exception_exit_1; 160             goto frame_exception_exit_1;
161         } 161         }
162     } 162     }
n 163     { n
164         nuitka_bool tmp_condition_result_1;
165         PyObject *tmp_compexpr_left_1;
166         PyObject *tmp_compexpr_right_1;
167         CHECK_OBJECT(par_value1);
168         tmp_compexpr_left_1 = par_value1;
169         CHECK_OBJECT(par_value2);
170         tmp_compexpr_right_1 = par_value2;
171         tmp_condition_result_1 = RICH_COMPARE_EQ_NBOOL_OBJECT_OBJECT(tmp_compexpr_left_1, tmp_compexpr_right_1);
172         if (tmp_condition_result_1 == NUITKA_BOOL_EXCEPTION) {
173             assert(ERROR_OCCURRED());
174  
175             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
176  
177  
178             exception_lineno = 31;
179             type_description_1 = "oo";
180             goto frame_exception_exit_1;
181         }
182         if (tmp_condition_result_1 == NUITKA_BOOL_TRUE) {
183             goto branch_yes_1;
184         } else {
185             goto branch_no_1;
186         }
187         assert(tmp_condition_result_1 != NUITKA_BOOL_UNASSIGNED);
188     }
189     branch_yes_1:;
190     tmp_return_value = Py_None;
191     Py_INCREF(tmp_return_value);
192     goto frame_return_exit_1;
193     branch_no_1:;
194 163
195 #if 0 164 #if 0
196     RESTORE_FRAME_EXCEPTION(frame_689719963472296c0b70d49934c42f45); 165     RESTORE_FRAME_EXCEPTION(frame_689719963472296c0b70d49934c42f45);
197 #endif 166 #endif
198 167
199     // Put the previous frame back on top. 168     // Put the previous frame back on top.
200     popFrameStack(); 169     popFrameStack();
201 170
202     goto frame_no_exception_1; 171     goto frame_no_exception_1;
t 203   t
204     frame_return_exit_1:;
205 #if 0
206     RESTORE_FRAME_EXCEPTION(frame_689719963472296c0b70d49934c42f45);
207 #endif
208  
209     // Put the previous frame back on top.
210     popFrameStack();
211  
212     goto function_return_exit;
213 172
214     frame_exception_exit_1:; 173     frame_exception_exit_1:;
215 174
216 #if 0 175 #if 0
217     RESTORE_FRAME_EXCEPTION(frame_689719963472296c0b70d49934c42f45); 176     RESTORE_FRAME_EXCEPTION(frame_689719963472296c0b70d49934c42f45);