Improve replace_with performance
gkorland opened this issue · comments
Current replace_with code seems very inefficient
- Find all values.
- Compute all paths from values found in (1)
- 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 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.
implementing 3.x.
did you mean 0.3.x?
yes. 0.3.x
@freestrings when do you plan to release 0.3.0?
@gkorland I am planning a release next month. after finishing testing Nginx module, it will be next month.
Is it resolved?