Construct GeneratorUsage

Performance Diagrams

Construct GeneratorUsage 002000000200000040000004000000600000060000008000000800000010000000100000001200000012000000140000001400000016000000160000001800000018000000200000002000000022000000220000002400000024000000CPython 3.10Nuitka (main)Nuitka (develop)Nuitka (factory)2530906688.95192307692307257.0CPython 3.105800138242.31730769230768447.483372486122Nuitka (main)5899766395.6826923076923446.5106138889276Nuitka (develop)5899982549.0480769230769446.50850488486253Nuitka (factory)Construct GeneratorUsageTicks Construct GeneratorUsage 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 3.8Nuitka (main)Nuitka (develop)Nuitka (factory)2379055188.95192307692307257.0CPython 3.85799753242.31730769230768443.87263558156735Nuitka (main)5899831395.6826923076923442.8331130643487Nuitka (develop)5900076549.0480769230769442.8305682191608Nuitka (factory)Construct GeneratorUsageTicks Construct GeneratorUsage 004000000400000080000008000000120000001200000016000000160000002000000020000000240000002400000028000000280000003200000032000000CPython 2.7Nuitka (main)Nuitka (develop)Nuitka (factory)3454929988.95192307692307257.0CPython 2.77449984242.31730769230768450.8290455339908Nuitka (main)7650000395.6826923076923449.3984222739Nuitka (develop)7650000549.0480769230769449.3984222739Nuitka (factory)Construct GeneratorUsageTicks

Source Code with Construct

    return x


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

    return x


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
13 13
14     gen = generator() 14     gen = generator()
15 15
16     x = next(gen) 16     x = next(gen)
17     # construct_begin 17     # construct_begin
t 18     next(gen) t 18  
19     # construct_end 19  
20 20
21     return x 21     return x
22 22
23 23
24 for x in itertools.repeat(None, 50000): 24 for x in itertools.repeat(None, 50000):

Context Diff of Generated Code


Construct
Baseline
117     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 117     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
118     PyObject *exception_type = NULL; 118     PyObject *exception_type = NULL;
119     PyObject *exception_value = NULL; 119     PyObject *exception_value = NULL;
120     PyTracebackObject *exception_tb = NULL; 120     PyTracebackObject *exception_tb = NULL;
121     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 121     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 122     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; n
123     static struct Nuitka_FrameObject *cache_frame_0e3929eae9272b58ded6c92efadf96a1 = NULL; 122     static struct Nuitka_FrameObject *cache_frame_0e3929eae9272b58ded6c92efadf96a1 = NULL;
124     PyObject *tmp_return_value = NULL; 123     PyObject *tmp_return_value = NULL;
125     PyObject *exception_keeper_type_1; 124     PyObject *exception_keeper_type_1;
126     PyObject *exception_keeper_value_1; 125     PyObject *exception_keeper_value_1;
127     PyTracebackObject *exception_keeper_tb_1; 126     PyTracebackObject *exception_keeper_tb_1;
206             exception_lineno = 16; 205             exception_lineno = 16;
207             goto frame_exception_exit_1; 206             goto frame_exception_exit_1;
208         } 207         }
209         assert(var_x == NULL); 208         assert(var_x == NULL);
210         var_x = tmp_assign_source_3; 209         var_x = tmp_assign_source_3;
n 211     } n
212     {
213         PyObject *tmp_value_value_2;
214         PyObject *tmp_next_value_1;
215         CHECK_OBJECT(var_gen);
216         tmp_value_value_2 = var_gen;
217         tmp_next_value_1 = ITERATOR_NEXT(tmp_value_value_2);
218         if (tmp_next_value_1 == NULL) {
219             if (!HAS_ERROR_OCCURRED(tstate)) {
220                 exception_type = PyExc_StopIteration;
221                 Py_INCREF(exception_type);
222                 exception_value = NULL;
223                 exception_tb = NULL;
224             } else {
225                 FETCH_ERROR_OCCURRED(tstate, &exception_type, &exception_value, &exception_tb);
226             }
227  
228  
229             type_description_1 = "ooo";
230             exception_lineno = 18;
231             goto frame_exception_exit_1;
232         }
233         Py_DECREF(tmp_next_value_1);
234     } 210     }
235 211
236 212
237     // Put the previous frame back on top. 213     // Put the previous frame back on top.
238     popFrameStack(tstate); 214     popFrameStack(tstate);
307     CHECK_OBJECT(var_generator); 283     CHECK_OBJECT(var_generator);
308     Py_DECREF(var_generator); 284     Py_DECREF(var_generator);
309     var_generator = NULL; 285     var_generator = NULL;
310     Py_XDECREF(var_gen); 286     Py_XDECREF(var_gen);
311     var_gen = NULL; 287     var_gen = NULL;
t 312     Py_XDECREF(var_x); t
313     var_x = NULL;
314     // Re-raise. 288     // Re-raise.
315     exception_type = exception_keeper_type_1; 289     exception_type = exception_keeper_type_1;
316     exception_value = exception_keeper_value_1; 290     exception_value = exception_keeper_value_1;
317     exception_tb = exception_keeper_tb_1; 291     exception_tb = exception_keeper_tb_1;
318     exception_lineno = exception_keeper_lineno_1; 292     exception_lineno = exception_keeper_lineno_1;