Construct GeneratorExpressionUsage

Performance Diagrams

Construct GeneratorExpressionUsage 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)14847046088.11538461538461257.0CPython 2.788715904240.03846153846155356.4559462431889Nuitka (master)88715904391.96153846153845356.4559462431889Nuitka (develop)88715904543.8846153846154356.4559462431889Nuitka (factory)Construct GeneratorExpressionUsageTicks Construct GeneratorExpressionUsage 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)16022308988.11538461538461257.0CPython 3.880451595240.03846153846155380.03322538709665Nuitka (master)80451595391.96153846153845380.03322538709665Nuitka (develop)80451587543.8846153846154380.03323772566216Nuitka (factory)Construct GeneratorExpressionUsageTicks

Source Code with Construct

not_all = [1,1,1,1,1,1,1,1,0,1]

def calledRepeatedly():
    # We measure making a generator iterator step or not.
    gen = (x for x in not_all)

    # make sure it is started.
    x = next(gen)

    # This should abort.
# construct_begin
    all(gen)
# construct_end

    # make sure it is still running.
    y = next(gen)

    return x, y

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

print("OK.")

Source Code without Construct

not_all = [1,1,1,1,1,1,1,1,0,1]

def calledRepeatedly():
    # We measure making a generator iterator step or not.
    gen = (x for x in not_all)

    # make sure it is started.
    x = next(gen)

    # This should abort.
# construct_begin



    # make sure it is still running.
    y = next(gen)

    return x, y

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

print("OK.")

Context Diff of Source Code


Construct
Baseline
27     # make sure it is started. 27     # make sure it is started.
28     x = next(gen) 28     x = next(gen)
29 29
30     # This should abort. 30     # This should abort.
31 # construct_begin 31 # construct_begin
t 32     all(gen) t 32  
33 # construct_end 33  
34 34
35     # make sure it is still running. 35     # make sure it is still running.
36     y = next(gen) 36     y = next(gen)
37 37
38     return x, y 38     return x, y

Context Diff of Generated Code


Construct
Baseline
114     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 114     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
115     PyObject *exception_type = NULL; 115     PyObject *exception_type = NULL;
116     PyObject *exception_value = NULL; 116     PyObject *exception_value = NULL;
117     PyTracebackObject *exception_tb = NULL; 117     PyTracebackObject *exception_tb = NULL;
118     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 118     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 119     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; n
120     static struct Nuitka_FrameObject *cache_frame_319c1aab0b043721e5deb3c13343f002 = NULL; 119     static struct Nuitka_FrameObject *cache_frame_319c1aab0b043721e5deb3c13343f002 = NULL;
121     PyObject *tmp_return_value = NULL; 120     PyObject *tmp_return_value = NULL;
122     PyObject *exception_keeper_type_1; 121     PyObject *exception_keeper_type_1;
123     PyObject *exception_keeper_value_1; 122     PyObject *exception_keeper_value_1;
124     PyTracebackObject *exception_keeper_tb_1; 123     PyTracebackObject *exception_keeper_tb_1;
237             exception_lineno = 28; 236             exception_lineno = 28;
238             goto frame_exception_exit_1; 237             goto frame_exception_exit_1;
239         } 238         }
240         assert(var_x == NULL); 239         assert(var_x == NULL);
241         var_x = tmp_assign_source_3; 240         var_x = tmp_assign_source_3;
t 242     } t
243     {
244         PyObject *tmp_all_arg_1;
245         PyObject *tmp_capi_result_1;
246         CHECK_OBJECT(var_gen);
247         tmp_all_arg_1 = var_gen;
248         tmp_capi_result_1 = BUILTIN_ALL(tmp_all_arg_1);
249         if (tmp_capi_result_1 == NULL) {
250             assert(ERROR_OCCURRED());
251  
252             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
253  
254  
255             exception_lineno = 32;
256             type_description_1 = "ooo";
257             goto frame_exception_exit_1;
258         }
259         Py_DECREF(tmp_capi_result_1);
260     } 241     }
261     { 242     {
262         PyObject *tmp_assign_source_4; 243         PyObject *tmp_assign_source_4;
263         PyObject *tmp_value_name_2; 244         PyObject *tmp_value_name_2;
264         CHECK_OBJECT(var_gen); 245         CHECK_OBJECT(var_gen);