Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LRU Cache for DotPathToSlice #1890

Closed
wants to merge 4 commits into from
Closed

Add LRU Cache for DotPathToSlice #1890

wants to merge 4 commits into from

Conversation

nibbleshift
Copy link
Contributor

@nibbleshift nibbleshift commented May 8, 2023

Cache DotPathToSlice results to avoid allocations and str repls.

Reduces memory allocations and reduces CPU utilization in that code path by about 30%.

Signed-off-by: Steve McDaniel <[email protected]>
@nibbleshift nibbleshift requested a review from Jeffail as a code owner May 8, 2023 18:17
Signed-off-by: Steve McDaniel <[email protected]>
Signed-off-by: Steve McDaniel <[email protected]>
@Jeffail
Copy link
Collaborator

Jeffail commented Jun 4, 2023

Can we get some benchmark tests that show the before/after? Ideally with a realistic config, maybe as an addition to https://github.com/benthosdev/benthos/blob/main/public/service/benchmark_test.go#L17

I'm little hesitant to add caches in deep areas of the codebase and a lot of these changes are in places I'd expect to be cold paths.

@nibbleshift
Copy link
Contributor Author

Perhaps we can discuss merging my PR in gabs instead Jeffail/gabs#136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants