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

fix quadratic complexity in reference parser #1004

Merged
merged 1 commit into from Mar 1, 2024
Merged

fix quadratic complexity in reference parser #1004

merged 1 commit into from Mar 1, 2024

Conversation

rlidwka
Copy link
Member

@rlidwka rlidwka commented Feb 4, 2024

should fix #996

instead of calling state.getLines on the entire thing (until empty line), it now pulls in lines as needed

@RomanHotsiy please check if there's any improvement on your data

Copy link

@RomanHotsiy RomanHotsiy left a comment

Choose a reason for hiding this comment

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

Thanks @rlidwka!!! Sorry for the delay.

This is amazing idea!
It improves the performance a lot! On my big list of reference links (1000 lines) it gets ~27x speed improvement 🔥

version from main

Sample: block-ref-list.md (63653 bytes)
 > current x 16.89 ops/sec ±0.50% (45 runs sampled)

version from this branch

Sample: block-ref-list.md (63653 bytes)
 > current x 437 ops/sec ±0.27% (91 runs sampled)

@rlidwka rlidwka merged commit de814ca into master Mar 1, 2024
2 checks passed
@rlidwka rlidwka deleted the references branch March 2, 2024 20:29
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.

Major performance issue when parsing a long list of reference links
2 participants