Skip to content

fix quadratic complexity in reference parser#1004

Merged
rlidwka merged 1 commit into
masterfrom
references
Mar 1, 2024
Merged

fix quadratic complexity in reference parser#1004
rlidwka merged 1 commit into
masterfrom
references

Conversation

@rlidwka

@rlidwka rlidwka commented Feb 4, 2024

Copy link
Copy Markdown
Member

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

@RomanHotsiy RomanHotsiy left a comment

Copy link
Copy Markdown

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
@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