Closed jacobroschen closed 2 years ago
@jacobroschen : Would you be interested in maintaining the library if @s3u approves? I no longer have the energy to do more than some trivial updates (and even that is uncertain).
@brettz9 I'd be open to being a maintainer.
@brettz9 It seems like @s3u also doesn't have time to review this. Any chance you could help move it along soon or make me a maintainer?
Hi @brettz9, sorry to ping you again, but is there any chance we could make progress on this PR or add me as a maintainer? If not, that's fine and I can fork this repo and maintain that.
@jacobroschen : Apologies for the delay. I've added you as maintainer.
If you can just ensure that we keep up the tests and 100% coverage for any new features, maintaining backward compatibility and at least retaining performance as at all possible, that would be great. For new features, hopefully we can align with json-path-comparison, a json-path standardization effort.
json-querying-performance-testing might be of interest to you given your performance bent.
Best wishes and thanks very much!
@brettz9 Thank you for you help here. I'll keep those notes in mind for future work, and I appreciate you getting this library to what it is today.
Searched for a performance update, because at the moment it is causing problems with spectral. Tried spectral with this change, it improves the performance very well. Do you plan to release a patch version with this change in the near future?
Kind regards, Frederic
@jacobroschen : Let me know when ready for an npm release. @FredericKayser
@brettz9 I'm good for an npm release. Is there anything you want me to do for it? Or will you handle it all?
@jacobroschen : For now, I can handle it; I'd like to keep the dev. packages up to date and just review. I've made it a minor release rather than patch release to be a little more careful with it not technically being a fix.
PR description
Use NodeJS' vm.Script class to cache the script that the context needs to be evaluated against. This provides large speed improvements (~50%) when a path contains conditional or JS logic.
To evaluate the performance improvements, I ran json-querying-performance-testing against a 16" 2019 MacBook Pro with an i9. Three runs were averaged together, with deltas calculated against main.
One interesting thing to note is there does appear to be a slight (<2%) performance regression on shallow and deep queries. I think given the purpose of this library (advanced JSON Path selectors, with full logic), that the slight performance regression is well worth the large (~50%) performance increase for conditional queries.
In a real world project, with a wide range of selector complexity, I saw ~24% speed improvement.
Checklist
npm test
, ensuring linting passes