Construct BuiltinSumWithTuple

Performance Diagrams

Construct BuiltinSumWithTuple 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000CPython 2.7Nuitka (master)Nuitka (develop)Nuitka (factory)1449900888.95192307692307344.8741429059829CPython 2.710000000242.31730769230768394.2863247863248Nuitka (master)22500000395.6826923076923257.0Nuitka (develop)22500000549.0480769230769257.0Nuitka (factory)Construct BuiltinSumWithTupleTicks Construct BuiltinSumWithTuple 00200000020000004000000400000060000006000000800000080000001000000010000000120000001200000014000000140000001600000016000000180000001800000020000000200000002200000022000000240000002400000026000000260000002800000028000000CPython 3.8Nuitka (master)Nuitka (develop)Nuitka (factory)2884933988.95192307692307257.0CPython 3.820850875242.31730769230768325.5126098623025Nuitka (master)20850867395.6826923076923325.51267838806933Nuitka (develop)20850867549.0480769230769325.51267838806933Nuitka (factory)Construct BuiltinSumWithTupleTicks

Source Code with Construct

empty = ()

value = tuple(range(10))

def calledRepeatedly(iterable, empty):
    # Force frame
    value

    # We measure making a tuple iterator step or not.

# construct_begin
    y = sum(iterable)
# construct_alternative



    return x, y

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly(value, empty)

print("OK.")

Source Code without Construct

empty = ()

value = tuple(range(10))

def calledRepeatedly(iterable, empty):
    # Force frame
    value

    # We measure making a tuple iterator step or not.

# construct_begin

# construct_alternative
    y = sum(empty)
# construct_end

    return x, y

import itertools
for x in itertools.repeat(None, 50000):
    calledRepeatedly(value, empty)

print("OK.")

Context Diff of Source Code


Construct
Baseline
27     value 27     value
28 28
29     # We measure making a tuple iterator step or not. 29     # We measure making a tuple iterator step or not.
30 30
31 # construct_begin 31 # construct_begin
n 32     y = sum(iterable) n 32  
33 # construct_alternative 33 # construct_alternative
t 34   t 34     y = sum(empty)
35   35 # construct_end
36 36
37     return x, y 37     return x, y
38 38
39 import itertools 39 import itertools
40 for x in itertools.repeat(None, 50000): 40 for x in itertools.repeat(None, 50000):

Context Diff of Generated Code


Construct
Baseline
167         } 167         }
168     } 168     }
169     { 169     {
170         PyObject *tmp_assign_source_1; 170         PyObject *tmp_assign_source_1;
171         PyObject *tmp_sum_sequence_1; 171         PyObject *tmp_sum_sequence_1;
n 172         CHECK_OBJECT(par_iterable); n 172         CHECK_OBJECT(par_empty);
173         tmp_sum_sequence_1 = par_iterable; 173         tmp_sum_sequence_1 = par_empty;
174         tmp_assign_source_1 = BUILTIN_SUM1(tmp_sum_sequence_1); 174         tmp_assign_source_1 = BUILTIN_SUM1(tmp_sum_sequence_1);
175         if (tmp_assign_source_1 == NULL) { 175         if (tmp_assign_source_1 == NULL) {
176             assert(ERROR_OCCURRED()); 176             assert(ERROR_OCCURRED());
177 177
178             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb); 178             FETCH_ERROR_OCCURRED(&exception_type, &exception_value, &exception_tb);
179 179
180 180
t 181             exception_lineno = 32; t 181             exception_lineno = 34;
182             type_description_1 = "ooo"; 182             type_description_1 = "ooo";
183             goto frame_exception_exit_1; 183             goto frame_exception_exit_1;
184         } 184         }
185         assert(var_y == NULL); 185         assert(var_y == NULL);
186         var_y = tmp_assign_source_1; 186         var_y = tmp_assign_source_1;