Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: parallelize ngram indexing #3501

Merged
merged 5 commits into from
Mar 3, 2025

Conversation

BubbleCal
Copy link
Contributor

@BubbleCal BubbleCal commented Mar 3, 2025

total indexing time reduced from 23s to 5s

ngram_index(1000000)    time:   [5.1192 s 5.1756 s 5.2319 s]
                        change: [-78.163% -77.791% -77.410%] (p = 0.00 < 0.05)
                        Performance has improved.

Signed-off-by: BubbleCal <bubble-cal@outlook.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 3, 2025

Codecov Report

Attention: Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.

Project coverage is 78.46%. Comparing base (33ae43b) to head (e520053).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
rust/lance-index/src/scalar/ngram.rs 97.14% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3501      +/-   ##
==========================================
- Coverage   78.48%   78.46%   -0.03%     
==========================================
  Files         252      252              
  Lines       94011    94078      +67     
  Branches    94011    94078      +67     
==========================================
+ Hits        73783    73815      +32     
- Misses      17232    17268      +36     
+ Partials     2996     2995       -1     
Flag Coverage Δ
unittests 78.46% <97.14%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@BubbleCal BubbleCal changed the title perf: parallize ngram indexing perf: parallelize ngram indexing Mar 3, 2025
Signed-off-by: BubbleCal <bubble-cal@outlook.com>
@BubbleCal BubbleCal marked this pull request as ready for review March 3, 2025 12:42
@BubbleCal BubbleCal requested a review from westonpace March 3, 2025 12:42
Signed-off-by: BubbleCal <bubble-cal@outlook.com>
@@ -465,12 +467,56 @@ impl NGramIndexBuilder {
let schema = data.schema();
Self::validate_schema(schema.as_ref())?;

let num_shards = *LANCE_FTS_NUM_SHARDS;
let buffer_size = get_num_compute_intensive_cpus()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure I understand the buffer_size calculation? How is it related to get_num_compute_intensive_cpus? Why not just used a small fixed number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh I forget why it's calculated as this, this is from FTS indexing code. But yes it looks like a small fixed numbers is fine here. set it to 2

Signed-off-by: BubbleCal <bubble-cal@outlook.com>
Signed-off-by: BubbleCal <bubble-cal@outlook.com>
@westonpace westonpace merged commit a144028 into lancedb:main Mar 3, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants