.. title: Construct OperationIntegerAdd
.. tags: 310_develop_steady_vs_main,310_factory_steady_vs_develop,38_develop_steady_vs_main,38_factory_steady_vs_develop,27_develop_steady_vs_main,27_factory_steady_vs_develop
.. date: 03/28/2024, 10:20:18
.. contents::
Performance Diagrams
====================
.. chart:: Bar
:title: 'Construct OperationIntegerAdd'
:x_labels: ['CPython 3.10', 'Nuitka (main)', 'Nuitka (develop)', 'Nuitka (factory)']
'Ticks', [14773120, 9549761, 9549822, 9549552]
.. chart:: Bar
:title: 'Construct OperationIntegerAdd'
:x_labels: ['CPython 3.8', 'Nuitka (main)', 'Nuitka (develop)', 'Nuitka (factory)']
'Ticks', [14694032, 10000425, 10000083, 10000299]
.. chart:: Bar
:title: 'Construct OperationIntegerAdd'
:x_labels: ['CPython 2.7', 'Nuitka (main)', 'Nuitka (develop)', 'Nuitka (factory)']
'Ticks', [8034111, 2450253, 2450058, 2450054]
Source Code with Construct
==========================
.. code-block:: python
# construct_end
return s, t, 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
=============================
.. code-block:: python
return s, t, 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
===========================
.. raw:: html
|
|
| local_value = module_value1 | | local_value = module_value1 |
| | | |
| s = module_value1 | | s = module_value1 |
| t = module_value2 | | t = module_value2 |
| # construct_begin | | # construct_begin |
t | t = s + t | t | |
| # construct_end | | |
| | | |
| return s, t, local_value | | return s, t, local_value |
| | | |
| | | |
| for x in itertools.repeat(None, 50000): | | for x in itertools.repeat(None, 50000): |
Context Diff of Generated Code
==============================
.. raw:: html
|
|
| goto frame_exception_exit_1; | | goto frame_exception_exit_1; |
| } | | } |
| assert(var_t == NULL); | | assert(var_t == NULL); |
| Py_INCREF(tmp_assign_source_3); | | Py_INCREF(tmp_assign_source_3); |
| var_t = tmp_assign_source_3; | | var_t = tmp_assign_source_3; |
n | } | n | |
| { | | |
| PyObject *tmp_assign_source_4; | | |
| PyObject *tmp_add_expr_left_1; | | |
| PyObject *tmp_add_expr_right_1; | | |
| CHECK_OBJECT(var_s); | | |
| tmp_add_expr_left_1 = var_s; | | |
| CHECK_OBJECT(var_t); | | |
| tmp_add_expr_right_1 = var_t; | | |
| tmp_assign_source_4 = BINARY_OPERATION_ADD_OBJECT_OBJECT_OBJECT(tmp_add_expr_left_1, tmp_add_expr_right_1); | | |
| if (tmp_assign_source_4 == NULL) { | | |
| assert(HAS_ERROR_OCCURRED(tstate)); | | |
| | | |
| FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); | | |
| | | |
| | | |
| exception_lineno = 19; | | |
| type_description_1 = "ooo"; | | |
| goto frame_exception_exit_1; | | |
| } | | |
| { | | |
| PyObject *old = var_t; | | |
| assert(old != NULL); | | |
| var_t = tmp_assign_source_4; | | |
| Py_DECREF(old); | | |
| } | | |
| | | |
| } | | } |
| | | |
| | | |
| // Put the previous frame back on top. | | // Put the previous frame back on top. |
| popFrameStack(tstate); | | popFrameStack(tstate); |
| | | |
| Py_XDECREF(var_local_value); | | Py_XDECREF(var_local_value); |
| var_local_value = NULL; | | var_local_value = NULL; |
| Py_XDECREF(var_s); | | Py_XDECREF(var_s); |
| var_s = NULL; | | var_s = NULL; |
t | Py_XDECREF(var_t); | t | |
| var_t = NULL; | | |
| // Re-raise. | | // Re-raise. |
| exception_type = exception_keeper_type_1; | | exception_type = exception_keeper_type_1; |
| exception_value = exception_keeper_value_1; | | exception_value = exception_keeper_value_1; |
| exception_tb = exception_keeper_tb_1; | | exception_tb = exception_keeper_tb_1; |
| exception_lineno = exception_keeper_lineno_1; | | exception_lineno = exception_keeper_lineno_1; |