-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Compute document's relative_path faster #6767
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable
@ashmaroli Would you mind placing the benchmark script in the PR body into the repo?
|
Sure.. not a problem.. 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
@jekyllbot: merge +minor |
Use
String#sub
instead ofPathutil#relative_path_from
which uses regexes internallyBenchmark script:
Note: Since
Document#relative_path
is a memoized function, the difference is noticeable only on large sites that containing a huge number ofDocument
s