Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Conversation

@jlutzhbo
Copy link

@jlutzhbo jlutzhbo commented Jun 20, 2018

This is the approach taken in dchester#75.

It does result in significant speedup, as the author suggests. It utilizes Underscore's memoize function: https://underscorejs.org/#memoize

This could result in memory issues if clients have a large number of dynamically generated JSON paths, but we currently have no such use cases. All our JSON paths are static. This affects caching only, not functionality, so it is covered by existing tests cases.

A better long-term approach might be to allow users of this library to pre-parse expressions and then pass them into functions that take the AST instead of string paths, but that's a bigger lift.

@jlutzhbo jlutzhbo requested a review from jennyzhua June 20, 2018 21:11
@jlutzhbo jlutzhbo merged commit d3d7b6c into master Jun 20, 2018
@jlutzhbo jlutzhbo deleted the jlutz/memoize branch June 20, 2018 21:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants