Construct GeneratorExpressionUsage

Performance Diagrams

Construct GeneratorExpressionUsage 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)14847242688.11538461538461257.00000000000006CPython 2.787071299240.03846153846155359.1951585436011Nuitka (master)87071299391.96153846153845359.1951585436011Nuitka (develop)87071299543.8846153846154359.1951585436011Nuitka (factory)Construct GeneratorExpressionUsageTicks Construct GeneratorExpressionUsage 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)16022269988.11538461538461257.0CPython 3.893092276240.03846153846155360.53689210439813Nuitka (master)93092276391.96153846153845360.53689210439813Nuitka (develop)93092270543.8846153846154360.5369013583448Nuitka (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_46fde2a6a0f6a220e554d44da7510241 = NULL; 107     static struct Nuitka_FrameObject *cache_frame_46fde2a6a0f6a220e554d44da7510241 = 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         if (var_gen == NULL) {
235  
236             FORMAT_UNBOUND_LOCAL_ERROR(&exception_type, &exception_value, mod_consts[1]);
237             exception_tb = NULL;
238             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
239             CHAIN_EXCEPTION(exception_value);
240  
241             exception_lineno = 32;
242             type_description_1 = "ooo";
243             goto frame_exception_exit_1;
244         }
245  
246         tmp_all_arg_1 = var_gen;
247         tmp_capi_result_1 = BUILTIN_ALL(tmp_all_arg_1);
248         if (tmp_capi_result_1 == NULL) {
249             assert(ERROR_OCCURRED());
250  
251             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
252  
253  
254             exception_lineno = 32;
255             type_description_1 = "ooo";
256             goto frame_exception_exit_1;
257         }
258         Py_DECREF(tmp_capi_result_1);
259     } 229     }
260     { 230     {
261         PyObject *tmp_assign_source_4; 231         PyObject *tmp_assign_source_4;
262         PyObject *tmp_value_name_2; 232         PyObject *tmp_value_name_2;
263         if (var_gen == NULL) { 233         if (var_gen == NULL) {