gabs icon indicating copy to clipboard operation
gabs copied to clipboard

Add LRU cache for JSONPointerToSlice and DotPathToSlice.

Open nibbleshift opened this issue 1 year ago • 4 comments

This caches DotPathToSlice and JSONPointerToSlice to prevent unnecessary allocations and string replacements on paths/pointers that are frequently looked up.

nibbleshift avatar May 08 '23 17:05 nibbleshift

Closing this out and submitting a PR to benthos.

nibbleshift avatar May 08 '23 21:05 nibbleshift

@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.

nibbleshift avatar Aug 24 '23 11:08 nibbleshift

Benchmarks

main: image

With cache: image

nibbleshift avatar Feb 19 '24 03:02 nibbleshift

Benchmarks:

main image

cache: image

nibbleshift avatar Feb 19 '24 03:02 nibbleshift