Construct GeneratorExpressionUsage

Performance Diagrams

Construct GeneratorExpressionUsage 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)14847241888.11538461538461257.0CPython 2.792671205240.03846153846155349.87474669200856Nuitka (master)92671205391.96153846153845349.87474669200856Nuitka (develop)92671205543.8846153846154349.87474669200856Nuitka (factory)Construct GeneratorExpressionUsageTicks Construct GeneratorExpressionUsage 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)19462594788.11538461538461257.0CPython 3.586146749240.03846153846155394.73537983883756Nuitka (master)86146749391.96153846153845394.73537983883756Nuitka (develop)86146749543.8846153846154394.73537983883756Nuitka (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
94     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 94     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
95     PyObject *exception_type = NULL; 95     PyObject *exception_type = NULL;
96     PyObject *exception_value = NULL; 96     PyObject *exception_value = NULL;
97     PyTracebackObject *exception_tb = NULL; 97     PyTracebackObject *exception_tb = NULL;
98     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 98     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 99     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; n
100     static struct Nuitka_FrameObject *cache_frame_a1cce3b7d924dea17d0b3dcc85b0b94a = NULL; 99     static struct Nuitka_FrameObject *cache_frame_a1cce3b7d924dea17d0b3dcc85b0b94a = NULL;
101     PyObject *tmp_return_value = NULL; 100     PyObject *tmp_return_value = NULL;
102     PyObject *exception_keeper_type_1; 101     PyObject *exception_keeper_type_1;
103     PyObject *exception_keeper_value_1; 102     PyObject *exception_keeper_value_1;
104     PyTracebackObject *exception_keeper_tb_1; 103     PyTracebackObject *exception_keeper_tb_1;
212             exception_lineno = 28; 211             exception_lineno = 28;
213             goto frame_exception_exit_1; 212             goto frame_exception_exit_1;
214         } 213         }
215         assert(var_x == NULL); 214         assert(var_x == NULL);
216         var_x = tmp_assign_source_3; 215         var_x = tmp_assign_source_3;
t 217     } t
218     {
219         PyObject *tmp_all_arg_1;
220         PyObject *tmp_capi_result_1;
221         CHECK_OBJECT(var_gen);
222         tmp_all_arg_1 = var_gen;
223         tmp_capi_result_1 = BUILTIN_ALL(tmp_all_arg_1);
224         if (tmp_capi_result_1 == NULL) {
225             assert(ERROR_OCCURRED());
226  
227             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
228  
229  
230             exception_lineno = 32;
231             type_description_1 = "ooo";
232             goto frame_exception_exit_1;
233         }
234         Py_DECREF(tmp_capi_result_1);
235     } 216     }
236     { 217     {
237         PyObject *tmp_assign_source_4; 218         PyObject *tmp_assign_source_4;
238         PyObject *tmp_value_name_2; 219         PyObject *tmp_value_name_2;
239         CHECK_OBJECT(var_gen); 220         CHECK_OBJECT(var_gen);