-
Notifications
You must be signed in to change notification settings - Fork 332
avoid path clone when not needed #398
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
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.
LGTM👍🏼
pub path: String, | ||
pub fixed: String, | ||
original_path: String, | ||
fixed_path: Option<String>, |
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.
Just a thought,
Can we even consider (also later) avoiding the fixed_path
member and calculate it when calling get_path
which will return the moved String? (either original or fixed if needed)
(assuming that once we pass it to JSONPath selector we don't need it anymore)
This will shorten the lifetime of the cloned/mutated strings to the minimum, but it will probably have none to very small impact (unless paths: &mut Vec<Path>
vector in method to_json
is big)
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.
👍🏼 LGTM
This should reduce the useless clone of the path when there is no need for backward compatibility with RedisJSON 1.0.x