-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] Decrease compaction RAM usage and increase speed #2729
Conversation
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
let embedding_arr = embedding_builder.values(); | ||
for entry in embedding.iter() { | ||
embedding_arr.append_value(*entry); | ||
match Arc::try_unwrap(self.inner) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we do let = match { match { so that we can avoid the nesting?
Please tag your PR title with one of: [ENH | BUG | DOC | TST | BLD | PERF | TYP | CLN | CHORE]. See https://docs.trychroma.com/contributing#contributing-code-and-ideas |
Perf results, comparing the latest in this branch against 14a744b with the other tokenizer and locking updates: Time profilingFollows the same experiment structure as #2736. sanket-branch-final-cpu.trace.zip Before (see trace in #2736):
After (run 1):
Memory profilinghttps://wormhole.app/Z26BY#aW8Ij5sW14ORvbbGpkPXiw
Before (run 2):
After (run 1):
|
## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - BTree of block deltas for postings list is now Vec<i32> instead of IntArray since the overhead of IntArray was seen to be 2 KB per btree add v/s 816 bytes for Vec<i32> - When getting blocks from block deltas at commit time, the block deltas are now drained. This reduces RAM consumption by about 50% - Removed the intermediary postings list builder that was more of an unnecessary complexity and also was doing clones - Changed get() for postings list to read slices instead of Vec<i32> getting rid of one more deep copy. ## Test plan *How are these changes tested?* - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes None
*Summarize the changes made by this PR.* - Improvements & Bug fixes - BTree of block deltas for postings list is now Vec<i32> instead of IntArray since the overhead of IntArray was seen to be 2 KB per btree add v/s 816 bytes for Vec<i32> - When getting blocks from block deltas at commit time, the block deltas are now drained. This reduces RAM consumption by about 50% - Removed the intermediary postings list builder that was more of an unnecessary complexity and also was doing clones - Changed get() for postings list to read slices instead of Vec<i32> getting rid of one more deep copy. *How are these changes tested?* - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust None
## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - In #2729 we changed to UInt32Array but some old data may be Int32Array. This is a rather ugly hack to preserve that behavior. - New functionality - None ## Test plan *How are these changes tested?* We are scoping cross-version tests, which are needed in general. - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes None
Description of changes
Summarize the changes made by this PR.
Test plan
How are these changes tested?
pytest
for python,yarn test
for js,cargo test
for rustDocumentation Changes
None