.. title: Construct FunctionEmpty
.. 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 FunctionEmpty'
:x_labels: ['CPython 3.10', 'Nuitka (main)', 'Nuitka (develop)', 'Nuitka (factory)']
'Ticks', [26631718, 2700121, 2700367, 2700188]
.. chart:: Bar
:title: 'Construct FunctionEmpty'
:x_labels: ['CPython 3.8', 'Nuitka (main)', 'Nuitka (develop)', 'Nuitka (factory)']
'Ticks', [22271543, 2699848, 2700081, 2700030]
.. chart:: Bar
:title: 'Construct FunctionEmpty'
:x_labels: ['CPython 2.7', 'Nuitka (main)', 'Nuitka (develop)', 'Nuitka (factory)']
'Ticks', [21280176, 2700000, 2700000, 2700000]
Source Code with Construct
==========================
.. code-block:: python
# construct_end
return called
for x in itertools.repeat(None, 50000):
calledRepeatedly(empty)
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 called
for x in itertools.repeat(None, 50000):
calledRepeatedly(empty)
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
|
|
| def calledRepeatedly(called): | | def calledRepeatedly(called): |
| # Force a frame for now | | # Force a frame for now |
| module_var | | module_var |
| | | |
| # construct_begin | | # construct_begin |
t | called() | t | |
| # construct_end | | |
| | | |
| return called | | return called |
| | | |
| | | |
| for x in itertools.repeat(None, 50000): | | for x in itertools.repeat(None, 50000): |
Context Diff of Generated Code
==============================
.. raw:: html
|
|
| exception_lineno = 16; | | exception_lineno = 16; |
| type_description_1 = "o"; | | type_description_1 = "o"; |
| goto frame_exception_exit_1; | | goto frame_exception_exit_1; |
| } | | } |
| } | | } |
t | { | t | |
| PyObject *tmp_called_value_1; | | |
| PyObject *tmp_call_result_1; | | |
| CHECK_OBJECT(par_called); | | |
| tmp_called_value_1 = par_called; | | |
| frame_9830863f35e3b5460bc546ad9ff66786->m_frame.f_lineno = 19; | | |
| tmp_call_result_1 = CALL_FUNCTION_NO_ARGS(tstate, tmp_called_value_1); | | |
| if (tmp_call_result_1 == NULL) { | | |
| assert(HAS_ERROR_OCCURRED(tstate)); | | |
| | | |
| FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb); | | |
| | | |
| | | |
| exception_lineno = 19; | | |
| type_description_1 = "o"; | | |
| goto frame_exception_exit_1; | | |
| } | | |
| Py_DECREF(tmp_call_result_1); | | |
| } | | |
| | | |
| | | |
| // Put the previous frame back on top. | | // Put the previous frame back on top. |
| popFrameStack(tstate); | | popFrameStack(tstate); |
| | | |