Skip to content

Commit

Permalink
Performance: avoid sorting the hashes in MatchHashesAndScoreQuery (#724)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexklibisz authored Aug 29, 2024
1 parent 9088ef5 commit c22b52a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/pages/performance/fashion-mnist/plot.b64

Large diffs are not rendered by default.

Binary file modified docs/pages/performance/fashion-mnist/plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions docs/pages/performance/fashion-mnist/results.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
|Model|Parameters|Recall|Queries per Second|
|---|---|---|---|
|eknn-l2lsh|L=100 k=4 w=1024 candidates=500 probes=0|0.379|380.371|
|eknn-l2lsh|L=100 k=4 w=1024 candidates=1000 probes=0|0.447|305.831|
|eknn-l2lsh|L=100 k=4 w=1024 candidates=500 probes=3|0.635|292.164|
|eknn-l2lsh|L=100 k=4 w=1024 candidates=1000 probes=3|0.717|253.758|
|eknn-l2lsh|L=100 k=4 w=2048 candidates=500 probes=0|0.767|330.408|
|eknn-l2lsh|L=100 k=4 w=2048 candidates=1000 probes=0|0.847|278.242|
|eknn-l2lsh|L=100 k=4 w=2048 candidates=500 probes=3|0.921|221.691|
|eknn-l2lsh|L=100 k=4 w=2048 candidates=1000 probes=3|0.960|197.147|
|eknn-l2lsh|L=100 k=4 w=1024 candidates=500 probes=0|0.378|373.943|
|eknn-l2lsh|L=100 k=4 w=1024 candidates=1000 probes=0|0.447|322.600|
|eknn-l2lsh|L=100 k=4 w=1024 candidates=500 probes=3|0.635|278.750|
|eknn-l2lsh|L=100 k=4 w=1024 candidates=1000 probes=3|0.717|248.708|
|eknn-l2lsh|L=100 k=4 w=2048 candidates=500 probes=0|0.767|328.214|
|eknn-l2lsh|L=100 k=4 w=2048 candidates=1000 probes=0|0.847|291.762|
|eknn-l2lsh|L=100 k=4 w=2048 candidates=500 probes=3|0.922|217.030|
|eknn-l2lsh|L=100 k=4 w=2048 candidates=1000 probes=3|0.960|197.218|
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ public MatchHashesAndScoreQuery(final String field,
final int candidates,
final IndexReader indexReader,
final Function<LeafReaderContext, ScoreFunction> scoreFunctionBuilder) {
// `countMatches` expects hashes to be in sorted order.
// java's sort seems to be faster than lucene's ArrayUtil.
java.util.Arrays.sort(hashAndFrequencies, HashAndFreq::compareTo);

this.field = field;
this.hashAndFrequencies = hashAndFrequencies;
this.candidates = candidates;
Expand Down

0 comments on commit c22b52a

Please sign in to comment.