Construct GeneratorExpressionUsage

Performance Diagrams

Construct GeneratorExpressionUsage 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)14847242288.11538461538461257.0CPython 2.787071312240.03846153846155359.19513300228607Nuitka (master)87071312391.96153846153845359.19513300228607Nuitka (develop)87071312543.8846153846154359.19513300228607Nuitka (factory)Construct GeneratorExpressionUsageTicks Construct GeneratorExpressionUsage 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)19462594788.11538461538461257.0CPython 3.586146843240.03846153846155394.7352604876076Nuitka (master)86146843391.96153846153845394.7352604876076Nuitka (develop)86147101543.8846153846154394.7349329065722Nuitka (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
101     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 101     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
102     PyObject *exception_type = NULL; 102     PyObject *exception_type = NULL;
103     PyObject *exception_value = NULL; 103     PyObject *exception_value = NULL;
104     PyTracebackObject *exception_tb = NULL; 104     PyTracebackObject *exception_tb = NULL;
105     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 105     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 106     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; n
107     static struct Nuitka_FrameObject *cache_frame_a701223e263d09bdd429370a8976884d = NULL; 106     static struct Nuitka_FrameObject *cache_frame_a701223e263d09bdd429370a8976884d = NULL;
108     PyObject *tmp_return_value = NULL; 107     PyObject *tmp_return_value = NULL;
109     PyObject *exception_keeper_type_1; 108     PyObject *exception_keeper_type_1;
110     PyObject *exception_keeper_value_1; 109     PyObject *exception_keeper_value_1;
111     PyTracebackObject *exception_keeper_tb_1; 110     PyTracebackObject *exception_keeper_tb_1;
224             exception_lineno = 28; 223             exception_lineno = 28;
225             goto frame_exception_exit_1; 224             goto frame_exception_exit_1;
226         } 225         }
227         assert(var_x == NULL); 226         assert(var_x == NULL);
228         var_x = tmp_assign_source_3; 227         var_x = tmp_assign_source_3;
t 229     } t
230     {
231         PyObject *tmp_all_arg_1;
232         PyObject *tmp_capi_result_1;
233         if (var_gen == NULL) {
234  
235             FORMAT_UNBOUND_LOCAL_ERROR(&exception_type, &exception_value, mod_consts[1]);
236             exception_tb = NULL;
237             NORMALIZE_EXCEPTION(&exception_type, &exception_value, &exception_tb);
238             CHAIN_EXCEPTION(exception_value);
239  
240             exception_lineno = 32;
241             type_description_1 = "ooo";
242             goto frame_exception_exit_1;
243         }
244  
245         tmp_all_arg_1 = var_gen;
246         tmp_capi_result_1 = BUILTIN_ALL(tmp_all_arg_1);
247         if (tmp_capi_result_1 == NULL) {
248             assert(ERROR_OCCURRED());
249  
250             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
251  
252  
253             exception_lineno = 32;
254             type_description_1 = "ooo";
255             goto frame_exception_exit_1;
256         }
257         Py_DECREF(tmp_capi_result_1);
258     } 228     }
259     { 229     {
260         PyObject *tmp_assign_source_4; 230         PyObject *tmp_assign_source_4;
261         PyObject *tmp_value_name_2; 231         PyObject *tmp_value_name_2;
262         if (var_gen == NULL) { 232         if (var_gen == NULL) {