gabs
gabs copied to clipboard
Add LRU cache for JSONPointerToSlice and DotPathToSlice.
This caches DotPathToSlice and JSONPointerToSlice to prevent unnecessary allocations and string replacements on paths/pointers that are frequently looked up.
Closing this out and submitting a PR to benthos.
@Jeffail Can we revisit this PR and discuss a bit more? I submitted a PR in benthos here https://github.com/benthosdev/benthos/pull/1890, but I really don't like my PR for benthos. It results in some sprawling code changes that are just ugly.
If you're open to it, I'd like to re-review this PR and possibly make some updates. Making the change in gabs is much more straight-forward and cleaner.
Benchmarks
main:
With cache:
Benchmarks:
main
cache: