Construct GeneratorExpressionUsage

Performance Diagrams

Construct GeneratorExpressionUsage 00100000001000000020000000200000003000000030000000400000004000000050000000500000006000000060000000700000007000000080000000800000009000000090000000100000000100000000110000000110000000120000000120000000130000000130000000140000000140000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)14847332288.11538461538461257.0CPython 2.792721205240.03846153846155349.79246702365106Nuitka (master)92721205391.96153846153845349.79246702365106Nuitka (develop)92721205543.8846153846154349.79246702365106Nuitka (factory)Construct GeneratorExpressionUsageTicks Construct GeneratorExpressionUsage 002000000020000000400000004000000060000000600000008000000080000000100000000100000000120000000120000000140000000140000000160000000160000000180000000180000000CPython 3.5Nuitka (master)Nuitka (develop)Nuitka (factory)19462654188.11538461538461257.0CPython 3.585343120240.03846153846155395.75607342012006Nuitka (master)86146740391.96153846153845394.73572509370854Nuitka (develop)86146740543.8846153846154394.73572509370854Nuitka (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
151     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL; 151     NUITKA_MAY_BE_UNUSED char const *type_description_1 = NULL;
152     PyObject *exception_type = NULL; 152     PyObject *exception_type = NULL;
153     PyObject *exception_value = NULL; 153     PyObject *exception_value = NULL;
154     PyTracebackObject *exception_tb = NULL; 154     PyTracebackObject *exception_tb = NULL;
155     NUITKA_MAY_BE_UNUSED int exception_lineno = 0; 155     NUITKA_MAY_BE_UNUSED int exception_lineno = 0;
n 156     NUITKA_MAY_BE_UNUSED nuitka_void tmp_unused; n
157     static struct Nuitka_FrameObject *cache_frame_543bfbe67a37d0dfe20e9b95ff65aa32 = NULL; 156     static struct Nuitka_FrameObject *cache_frame_543bfbe67a37d0dfe20e9b95ff65aa32 = NULL;
158     PyObject *tmp_return_value = NULL; 157     PyObject *tmp_return_value = NULL;
159     PyObject *exception_keeper_type_1; 158     PyObject *exception_keeper_type_1;
160     PyObject *exception_keeper_value_1; 159     PyObject *exception_keeper_value_1;
161     PyTracebackObject *exception_keeper_tb_1; 160     PyTracebackObject *exception_keeper_tb_1;
282             exception_lineno = 28; 281             exception_lineno = 28;
283             goto frame_exception_exit_1; 282             goto frame_exception_exit_1;
284         } 283         }
285         assert(var_x == NULL); 284         assert(var_x == NULL);
286         var_x = tmp_assign_source_3; 285         var_x = tmp_assign_source_3;
t 287     } t
288     {
289         PyObject *tmp_all_arg_1;
290         PyObject *tmp_capi_result_1;
291         CHECK_OBJECT(var_gen);
292         tmp_all_arg_1 = var_gen;
293         tmp_capi_result_1 = BUILTIN_ALL(tmp_all_arg_1);
294         if (tmp_capi_result_1 == NULL) {
295             assert(ERROR_OCCURRED());
296  
297             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
298  
299  
300             exception_lineno = 32;
301             type_description_1 = "ooo";
302             goto frame_exception_exit_1;
303         }
304         Py_DECREF(tmp_capi_result_1);
305     } 286     }
306     { 287     {
307         PyObject *tmp_assign_source_4; 288         PyObject *tmp_assign_source_4;
308         PyObject *tmp_value_name_2; 289         PyObject *tmp_value_name_2;
309         CHECK_OBJECT(var_gen); 290         CHECK_OBJECT(var_gen);