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

Move regular expression compilation to lazy_static! #9

Merged
merged 5 commits into from
Jan 7, 2022

Conversation

mdharm
Copy link
Collaborator

@mdharm mdharm commented Jan 6, 2022

Per the crate regex documentation, compiling a regular expression is expensive. Move the regex building to inside a lazy_static! so it only gets done once, regardless of how many Link: headers are parsed.

This resolves #6 and needs to be applied on top of / after merge request #5

Per the crate regex documentation, compiling a regular expression is
computationally expensive.  Thus, it is advantageous when processing
multiple Link: headers to use lazy_static! to compile it only once.

Also add some comments to struct Link for better doc rendering.

Add test cases to achieve 100% code coverage, per tarpaulin.
@g1eny0ung g1eny0ung self-requested a review January 7, 2022 07:26
@g1eny0ung
Copy link
Owner

I added codecov to help visualize the code coverage.

Copy link
Owner

@g1eny0ung g1eny0ung left a comment

Choose a reason for hiding this comment

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

LGTM! 🍻

@g1eny0ung g1eny0ung merged commit 58264bc into g1eny0ung:master Jan 7, 2022
@g1eny0ung g1eny0ung mentioned this pull request Jan 8, 2022
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.

Regular expression re-compiled at every call to parse()
2 participants