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

Optimize checking if track already exists. #9

Merged
merged 1 commit into from
Aug 19, 2021
Merged

Conversation

minht11
Copy link
Owner

@minht11 minht11 commented Aug 18, 2021

Previously each file handle was compared to one another using only isSameEntry, that's very expensive. Now we check if file names are also matching before using isSameEntry, because if file is renamed it will automatically won't match, so it's safe to do that. Other optimization is removing already found tracks from existing tracks search pool.

Original diff, on my machine, with 462 tracks, took 11000ms, with this PR it takes about 300ms. 36x times improvement. Still this could be optimized even more.

Partially fixes #8

@netlify
Copy link

netlify bot commented Aug 18, 2021

✔️ Deploy Preview for heuristic-ptolemy-02be89 ready!

🔨 Explore the source changes: 73273db

🔍 Inspect the deploy log: https://app.netlify.com/sites/heuristic-ptolemy-02be89/deploys/611d95a51958030007a7437c

😎 Browse the preview: https://deploy-preview-9--heuristic-ptolemy-02be89.netlify.app/

@5onderling
Copy link

Wow, this is way faster compared to what I tested. It somehow only took 2 seconds.

@minht11 minht11 merged commit bf15637 into main Aug 19, 2021
@minht11 minht11 deleted the optimize-tracks-diffing branch June 18, 2022 20:42
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.

Poor performance when checking if track already exists
2 participants