Skip to content

Reuse regex when parsing proc mountinfo#2

Open
robinkrahl wants to merge 1 commit intoGuillemCastro:masterfrom
robinkrahl:reuse-regex
Open

Reuse regex when parsing proc mountinfo#2
robinkrahl wants to merge 1 commit intoGuillemCastro:masterfrom
robinkrahl:reuse-regex

Conversation

@robinkrahl
Copy link

Instead of compiling a the same regex once for every line in the
mountinfo file, we can instead reuse the same regex for all lines.

Instead of compiling a the same regex once for every line in the
mountinfo file, we can instead reuse the same regex for all lines.
@robinkrahl
Copy link
Author

robinkrahl commented Aug 13, 2022

It would also be possible to use the same regex for all invocations (example), but multiple invocations are an unlikely use case and that would add additional dependencies (lazy_static, once_cell or similar). Therefore I think this change is a good trade-off between runtime and compile time costs.

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.

1 participant