jsonpath icon indicating copy to clipboard operation
jsonpath copied to clipboard

Improve replace_with performance

Open gkorland opened this issue 6 years ago • 6 comments

Current replace_with code seems very inefficient

  1. Find all values.
  2. Compute all paths from values found in (1)
  3. Find values to replace again using paths from (2) to replace
        let paths = {
  (1)          let result = self.select()?;
  (2)         self.compute_paths(result)
        };

        if let Some(ref mut value) = &mut self.value {
            for tokens in paths {
  (3)              replace_value(tokens, value, fun);
            }
        }

It seems like the replace should account in step (1) while running select()

gkorland avatar Aug 11 '19 12:08 gkorland

@gkorland yes, I think it's an improvement point too.

the double dot expressions (..) create duplicate reference as results, so deduplication is required when selecting. I didn't think of this when I first implemented the engine and due to the wide range of tests, i am ignoring this issue on 2.x versions.

I'm thinking about use cases like HTTP proxying or batch processing. I'll try to clean up use cases and to plan for performance improvements if necessary. It is going to proceed in 3.x.

this issue should be rethought when implementing 3.x.

freestrings avatar Aug 13 '19 13:08 freestrings

implementing 3.x. did you mean 0.3.x?

gkorland avatar Aug 13 '19 14:08 gkorland

yes. 0.3.x

freestrings avatar Aug 14 '19 00:08 freestrings

@freestrings when do you plan to release 0.3.0?

gkorland avatar Sep 15 '19 11:09 gkorland

@gkorland I am planning a release next month. after finishing testing Nginx module, it will be next month.

freestrings avatar Sep 16 '19 13:09 freestrings

Is it resolved?

rohitjoshi avatar Jan 15 '23 03:01 rohitjoshi