Skip to content

Commit

Permalink
test(benchmark): add benchmark for large add expression
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Sep 4, 2024
1 parent 1b9e211 commit e42a488
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ibis/tests/benchmarks/test_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import inspect
import itertools
import math
import operator
import os
import random
import string
Expand Down Expand Up @@ -870,6 +871,23 @@ def test_large_union_compile(benchmark, many_tables):
assert benchmark(ibis.to_sql, expr, dialect="duckdb") is not None


@pytest.mark.parametrize("cols", [128, 256])
@pytest.mark.parametrize("op", ["construct", "compile"])
def test_large_add(benchmark, cols, op):
t = ibis.table(name="t", schema={f"x{i}": "int" for i in range(cols)})

def construct():
return functools.reduce(operator.add, (t[c] for c in t.columns))

def compile(expr):
return ibis.to_sql(expr, dialect="duckdb")

if op == "construct":
benchmark(construct)
else:
benchmark(compile, construct())


@pytest.fixture(scope="session")
def lots_of_tables(tmp_path_factory):
duckdb = pytest.importorskip("duckdb")
Expand Down

0 comments on commit e42a488

Please sign in to comment.