-
Notifications
You must be signed in to change notification settings - Fork 53
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
Load tests/2.11.0 ccip1.4 #1023
Closed
Closed
Conversation
This file contains 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
## Motivation Every call to arm_contract.NewARMContract deserialized ARM contract abi under the hood. Considering that OnRamp.IsSourceCursed is called very often by the background worker it creates a huge CPU overhead. Please initialize ARMContract only once and cache it instead of doing it with every method call ## Solution * Add new cachedRmnContract field to OnRamp struct * Cache it once per OnRamp initialization * fix: Use correct cache function for StaticConfig * Add Benchmark before and after caching Note: I did benchmark the caching function against using a map with the address as key and the function caching was a bit faster. Also using the caching is more consistent with the current implementation like `StaticConfig`. Benchmark results: ``` BenchmarkIsSourceCursedWithCache-14 90266 12526 ns/op BenchmarkIsSourceCursedWithCache-14 88867 12411 ns/op BenchmarkIsSourceCursedWithCache-14 90930 12379 ns/op BenchmarkIsSourceCursedWithCache-14 91108 12259 ns/op BenchmarkIsSourceCursedWithCache-14 90915 12306 ns/op BenchmarkIsSourceCursedOriginal-14 3002 397356 ns/op BenchmarkIsSourceCursedOriginal-14 2996 402220 ns/op BenchmarkIsSourceCursedOriginal-14 3009 399806 ns/op BenchmarkIsSourceCursedOriginal-14 2575 397963 ns/op BenchmarkIsSourceCursedOriginal-14 2596 396812 ns/op ```
## Motivation ABIEncode/ABIDecode functions are used in multiple places in CCIP. Unfortunately, these functions keep serializing provided abi with every call to them and most (all?) of the usage in CCIP has always const abi that never change over time. ## Solution * Add a string to *abi.ABI map which is only accessible inside abi_helpers * Cache all abiStr ( distinguish between encode, decode for same abiStr) * Add new public facing functions for `ABIEncode` and `ABIDecode` and use them instead `utils.ABIEncode` and `utils.ABIDecode` Benchmark results: ``` BenchmarkComparisonEncode/WithoutCache-14 125930 8219 ns/op BenchmarkComparisonEncode/WithoutCache-14 145154 8355 ns/op BenchmarkComparisonEncode/WithoutCache-14 141247 8437 ns/op BenchmarkComparisonEncode/WithoutCache-14 141610 8371 ns/op BenchmarkComparisonEncode/WithCache-14 1219718 969.8 ns/op BenchmarkComparisonEncode/WithCache-14 1233378 979.3 ns/op BenchmarkComparisonEncode/WithCache-14 1220919 988.2 ns/op BenchmarkComparisonEncode/WithCache-14 1000000 1063 ns/op BenchmarkComparisonDecode/WithoutCache-14 149152 8080 ns/op BenchmarkComparisonDecode/WithoutCache-14 148034 7842 ns/op BenchmarkComparisonDecode/WithoutCache-14 149011 7815 ns/op BenchmarkComparisonDecode/WithoutCache-14 145190 8369 ns/op BenchmarkComparisonDecode/WithCache-14 2385868 501.6 ns/op BenchmarkComparisonDecode/WithCache-14 2335604 517.9 ns/op BenchmarkComparisonDecode/WithCache-14 2327654 495.4 ns/op BenchmarkComparisonDecode/WithCache-14 2376956 493.6 ns/op ```
## Motivation Currently we marshal the updated observation just to unmarshall it after returning from `commitObservationJSONBackComp`. ## Solution We can return the CommitObservation directly.
Co-authored-by: Domino Valdano <[email protected]>
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.
Motivation
Solution