BAAS-35403 use func over bool for runtime shouldTrackMaxMemOnStack#131
Merged
Conversation
There was a problem hiding this comment.
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
vm.go:863
- Consider reviewing the usage of 'string(vm.funcName)' to ensure that 'vm.funcName' is of a type that actually requires conversion. If it is already a string, the conversion may be unnecessary and could indicate a type inconsistency.
if !vm.r.shouldTrackMaxMemOnStack(string(vm.funcName)) {
vm_test.go:830
- [nitpick] Consider extracting the inline lambda assignment into a helper function since it appears in multiple test cases. This can reduce code duplication and improve clarity.
vmRuntime.shouldTrackMaxMemOnStack = func(_ string) bool {
Gabri3l
approved these changes
Apr 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Memory checking on the vm stack push was more expensive than anticipated with certain functions so refactoring to allow BAAS to declare what should be checked.
If we just check specific functions based on the function name, we can significantly reduce when the memory checks need to happen. We can pass in the function name of our microtask logic in the upstream event loop to more accurately capture memory usage with the drawback that this only works for asynchronous functions. Though this should cover the majority of our use cases so this should be ok.