Skip to content

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 <nibbleshift@gmail.com>
@nibbleshift nibbleshift requested a review from Jeffail as a code owner May 8, 2023 18:17
Signed-off-by: Steve McDaniel <nibbleshift@gmail.com>
Signed-off-by: Steve McDaniel <nibbleshift@gmail.com>
Signed-off-by: Steve McDaniel <nibbleshift@gmail.com>
@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