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

Optimize for performance instead of code size #197

Merged
merged 2 commits into from
Jul 23, 2021
Merged

Conversation

birchmd
Copy link
Member

@birchmd birchmd commented Jul 22, 2021

Benchmarks show that this significantly reduces gas usage (around 47%) for non-trivial contracts (e.g. uniswap). We have a larger binary as a result (678K -> 865K on my machine), but I think it is worthwhile.

@@ -26,6 +26,7 @@ jobs:
bully-build:
name: Bully build
runs-on: self-hosted
needs: test
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated to the opt-level change, but seems to make CI run better (prevents some kind of race causing a file to be deleted which is still needed by other tests).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that's interesting.
I suspect that, unfortunately, this will not solve the problem. Two or more concurrent "test" jobs can possibly produce the same issue.
Let me explain: each job is launched on random free runner (1 of 16), so each of them have it's own isolated workdir. Except only moment - they still share target/release and target/debug directories (you can see that I made them as symlinks), and this directories are shared for all runs and all jobs (even concurrent). I did a little research before doing it, it was stated that cargo target dir is OK for concurrent builds, but after seeing this - I doubt a lot. I mean, it's impossible to explain those races another way (because those are only files that are shared/concurrently used). I should probably redesign this part...
Do you know which particular file was under race? If it's under target/release or target/debug - it's definitely my fault here :)

@joshuajbouw
Copy link
Contributor

Thats a huge improvement, but I think we should have a discussion about which path we should go if contract bloat is better to reduce cost of gas, which I do agree, is far better. We should also have quite a large reduction when we have the native precomps too.

@joshuajbouw joshuajbouw merged commit 068e38e into develop Jul 23, 2021
@joshuajbouw joshuajbouw deleted the opt-level-3 branch July 23, 2021 13:20
artob added a commit that referenced this pull request Jul 30, 2021
* JSON: fix bugs and add unit tests. (#141)
* Add storage layout debug support for `EvmErc20.sol`. (#178)
* ERC-20: forbid using invalid NEP-141 AccountID for mapping. (#179)
* Add EIP-2930 support. (#181, #182)
* Migrate all workflows to self-hosted runners. (#185)
* Speed up the workflow using build caching. (#189)
* Use the new math API host functions. (#190)
* Fix `clippy::enum_variant_names` warning. (#192)
* Add different networks to the Makefile. (#193)
* Update the network status in the README. (#194)
* Remove the toolchain installation step in workflows. (#195)
* Run all tests for all networks in CI. (#196)
* Optimize for performance instead of code size. (#197)
* Parallelize the test suites. (#198)
* Add build-caching to the testing workflow. (#201)
* Refactor tests to use Signer. (#203)
* Add options to the bench profile. (#204)
* Remove a duplicate test. (#205)
* Add a sanity test for access list handling. (#206)
* Update nearcore to the latest branch.
* Add feature gates to the SDK's new host functions.

Co-authored-by: Ahmed Ali <ahmed@aurora.dev>
Co-authored-by: Dmitry Strokov <dmitry@aurora.dev>
Co-authored-by: Evgeny Ukhanov <evgeny@aurora.dev>
Co-authored-by: Joshua J. Bouw <joshua@aurora.dev>
Co-authored-by: Kirill <kirill@aurora.dev>
Co-authored-by: Michael Birch <michael@aurora.dev>
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.

3 participants