Skip to content

Commit

Permalink
fix benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
wjones127 committed Sep 7, 2023
1 parent f1f651a commit e9d12b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions python/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ Note the parameter `--benchmark-min-time`: this controls how many seconds to run
the benchmark in each round (default 5 rounds). The default is very low but you
can increase this so that the profile gets more samples.

You can drop the `--no-inline` to have the program try to identify which functions
were inlined to get more detail, though this will make the processing take
considerably longer.

This will only work on Linux.

Note that you'll want to run the benchmarks once prior to profiling, so that
Expand Down
15 changes: 9 additions & 6 deletions python/python/benchmarks/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ def test_dataset(data_dir: Path) -> lance.LanceDataset:

@pytest.mark.benchmark(group="query_ann")
def test_knn_search(test_dataset, benchmark):
q = pa.FixedSizeListArray.from_arrays(pc.random(N_DIMS).cast(pa.float32()), N_DIMS)
q = pc.random(N_DIMS).cast(pa.float32())
result = benchmark(
test_dataset.to_table,
nearest=dict(
column="vector",
q=q,
k=10,
k=100,
nprobes=10,
use_index=False,
),
Expand All @@ -61,12 +62,13 @@ def test_knn_search(test_dataset, benchmark):

@pytest.mark.benchmark(group="query_ann")
def test_flat_index_search(test_dataset, benchmark):
q = pa.FixedSizeListArray.from_arrays(pc.random(N_DIMS).cast(pa.float32()), N_DIMS)
q = pc.random(N_DIMS).cast(pa.float32())
result = benchmark(
test_dataset.to_table,
nearest=dict(
column="vector",
q=q,
k=10,
k=100,
nprobes=10,
),
)
Expand All @@ -75,12 +77,13 @@ def test_flat_index_search(test_dataset, benchmark):

@pytest.mark.benchmark(group="query_ann")
def test_ivf_pq_index_search(test_dataset, benchmark):
q = pa.FixedSizeListArray.from_arrays(pc.random(N_DIMS).cast(pa.float32()), N_DIMS)
q = pc.random(N_DIMS).cast(pa.float32())
result = benchmark(
test_dataset.to_table,
nearest=dict(
column="vector",
q=q,
k=10,
k=100,
nprobes=10,
refine_factor=2,
),
Expand Down

0 comments on commit e9d12b1

Please sign in to comment.