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

Several optimizations #737

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

masylum
Copy link

@masylum masylum commented Jun 17, 2024

I've been profiling orama, since it's taking 4s to ingest around 4k documents on my project and I would like to lower this down. I've noticed several things: It's ingesting a large amount of empty strings which is useless CPU time and also it's recalculating ids redundantly. This commit tries to address this two issues.

Additionally, I've noticed that due to the async APIs, the code is spending most of it's time waiting for "run microtasks". I have no idea if it would be possible to compile those away, because right now it makes the default implementation much worse (performance-wise) in order for people to be able to provide their storage solution.

Lastly, I've also noticed that providing the ID of the document, makes the ID be stored as part of the document properties. I thought it would only be to replace the default orama ID. I will fix this myself in userland by using getDocumentProperties, but perhaps is good to either change this default or document it.

I've been profiling orama, since it's taking 4s to ingest around 4k
documents on my project and I would like to lower this down. I've
noticed several things: It's ingesting a large amount of empty strings
which is useless CPU time and also it's recalculating ids redundantly.
This commit tries to address this two issues.

Additionally, I've noticed that due to the async APIs, the code is
spending most of it's time waiting for "run microtasks". I have no idea
if it would be possible to compile those away, because right now it
makes the default implementation much worse (performance-wise) in
order for people to be able to provide their storage solution.

Lastly, I've also noticed that providing the ID of the document, makes
the ID be stored as part of the document properties. I thought it would
only be to replace the default orama ID. I will fix this myself in
userland by using `getDocumentProperties`, but perhaps is good to either
change this default or document it.
Copy link

vercel bot commented Jun 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orama-docs ❌ Failed (Inspect) Jun 17, 2024 9:58am

@micheleriva
Copy link
Member

Hi there! I fear you'll need to regenerate the test snapshots. The PR looks good then!

Thank you so much

@masylum
Copy link
Author

masylum commented Jul 24, 2024

how do I do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants