Construct LocalVariableDeletion
Performance Diagrams
Source Code with Construct
module_value2 = local_value if module_value2 is None: # construct_begin del local_value # construct_end another_local_value = module_value3 module_value2 = module_value1 local_value = module_value3 return local_value for x in itertools.repeat(None, 50000): calledRepeatedly() 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
module_value2 = local_value if module_value2 is None: # construct_begin another_local_value = module_value3 module_value2 = module_value1 local_value = module_value3 return local_value for x in itertools.repeat(None, 50000): calledRepeatedly() 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 | ||||
---|---|---|---|---|---|
19 | 19 | ||||
20 | module_value2 = local_value | 20 | module_value2 = local_value | ||
21 | 21 | ||||
22 | if module_value2 is None: | 22 | if module_value2 is None: | ||
23 | # construct_begin | 23 | # construct_begin | ||
t | 24 | del local_value | t | 24 | |
25 | # construct_end | 25 | |||
26 | 26 | ||||
27 | another_local_value = module_value3 | 27 | another_local_value = module_value3 | ||
28 | 28 | ||||
29 | module_value2 = module_value1 | 29 | module_value2 = module_value1 | ||
30 | 30 |
Context Diff of Generated Code
Construct | Baseline | ||||
---|---|---|---|---|---|
212 | } else { | 212 | } else { | ||
213 | goto branch_no_1; | 213 | goto branch_no_1; | ||
214 | } | 214 | } | ||
215 | } | 215 | } | ||
216 | branch_yes_1:; | 216 | branch_yes_1:; | ||
n | 217 | CHECK_OBJECT(var_local_value); | n | ||
218 | Py_DECREF(var_local_value); | ||||
219 | var_local_value = NULL; | ||||
220 | |||||
221 | { | 217 | { | ||
222 | PyObject *tmp_assign_source_3; | 218 | PyObject *tmp_assign_source_3; | ||
223 | tmp_assign_source_3 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[2]); | 219 | tmp_assign_source_3 = GET_STRING_DICT_VALUE(moduledict___main__, (Nuitka_StringObject *)mod_consts[2]); | ||
224 | 220 | ||||
225 | if (unlikely(tmp_assign_source_3 == NULL)) { | 221 | if (unlikely(tmp_assign_source_3 == NULL)) { | ||
279 | type_description_1 = "oo"; | 275 | type_description_1 = "oo"; | ||
280 | goto frame_exception_exit_1; | 276 | goto frame_exception_exit_1; | ||
281 | } | 277 | } | ||
282 | { | 278 | { | ||
283 | PyObject *old = var_local_value; | 279 | PyObject *old = var_local_value; | ||
n | n | 280 | assert(old != NULL); | ||
284 | var_local_value = tmp_assign_source_5; | 281 | var_local_value = tmp_assign_source_5; | ||
285 | Py_INCREF(var_local_value); | 282 | Py_INCREF(var_local_value); | ||
t | 286 | Py_XDECREF(old); | t | 283 | Py_DECREF(old); |
287 | } | 284 | } | ||
288 | 285 | ||||
289 | } | 286 | } | ||
290 | 287 | ||||
291 | 288 |