Construct GeneratorExpressionUsage

Performance Diagrams

Construct GeneratorExpressionUsage 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)14847046088.11538461538461257.0CPython 2.787071405240.03846153846155359.1930631274811Nuitka (master)87071405391.96153846153845359.1930631274811Nuitka (develop)87907983543.8846153846154357.8006562188558Nuitka (factory)Construct GeneratorExpressionUsageTicks Construct GeneratorExpressionUsage 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)16022308988.11538461538461257.0CPython 3.880501587240.03846153846155379.95612169133847Nuitka (master)80501587391.96153846153845379.95612169133847Nuitka (develop)80451580543.8846153846154380.03324852190696Nuitka (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
102     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 102     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
103     PyObject *exception_type = NULL; 103     PyObject *exception_type = NULL;
104     PyObject *exception_value = NULL; 104     PyObject *exception_value = NULL;
105     PyTracebackObject *exception_tb = NULL; 105     PyTracebackObject *exception_tb = NULL;
106     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 106     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 107     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; n
108     static struct Nuitka_FrameObject *cache_frame_c75c346df0c5bee705aad70dadc81767 = NULL; 107     static struct Nuitka_FrameObject *cache_frame_c75c346df0c5bee705aad70dadc81767 = NULL;
109     PyObject *tmp_return_value = NULL; 108     PyObject *tmp_return_value = NULL;
110     PyObject *exception_keeper_type_1; 109     PyObject *exception_keeper_type_1;
111     PyObject *exception_keeper_value_1; 110     PyObject *exception_keeper_value_1;
112     PyTracebackObject *exception_keeper_tb_1; 111     PyTracebackObject *exception_keeper_tb_1;
225             exception_lineno = 28; 224             exception_lineno = 28;
226             goto frame_exception_exit_1; 225             goto frame_exception_exit_1;
227         } 226         }
228         assert(var_x == NULL); 227         assert(var_x == NULL);
229         var_x = tmp_assign_source_3; 228         var_x = tmp_assign_source_3;
t 230     } t
231     {
232         PyObject *tmp_all_arg_1;
233         PyObject *tmp_capi_result_1;
234         CHECK_OBJECT(var_gen);
235         tmp_all_arg_1 = var_gen;
236         tmp_capi_result_1 = BUILTIN_ALL(tmp_all_arg_1);
237         if (tmp_capi_result_1 == NULL) {
238             assert(ERROR_OCCURRED());
239  
240             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
241  
242  
243             exception_lineno = 32;
244             type_description_1 = "ooo";
245             goto frame_exception_exit_1;
246         }
247         Py_DECREF(tmp_capi_result_1);
248     } 229     }
249     { 230     {
250         PyObject *tmp_assign_source_4; 231         PyObject *tmp_assign_source_4;
251         PyObject *tmp_value_name_2; 232         PyObject *tmp_value_name_2;
252         CHECK_OBJECT(var_gen); 233         CHECK_OBJECT(var_gen);