Skip to content

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

Merged
merged 6 commits into from
Jul 5, 2021
Merged

avoid path clone when not needed #398

merged 6 commits into from
Jul 5, 2021

Conversation

gkorland
Copy link
Contributor

@gkorland gkorland commented Jun 20, 2021

This should reduce the useless clone of the path when there is no need for backward compatibility with RedisJSON 1.0.x

oshadmi
oshadmi previously approved these changes Jun 20, 2021
Copy link
Collaborator

@oshadmi oshadmi left a 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>,
Copy link
Collaborator

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)

Copy link
Collaborator

@oshadmi oshadmi left a comment

Choose a reason for hiding this comment

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

👍🏼 LGTM

@gkorland gkorland merged commit f001ee1 into master Jul 5, 2021
@gkorland gkorland deleted the avoid_path_clone branch July 5, 2021 18:13
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.

4 participants