-
Notifications
You must be signed in to change notification settings - Fork 726
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
Avoid compiling the same wasm twice because of GenesisBlockBuilder
#3449
Comments
I'll look into this, I'd expect that cache is re-used. Otherwise your proposal sounds right at first glance. |
Thanks, you can reproduce it by adding a log here:
I was able to see two calls with the same |
It seems that implementing your proposal is not that easy (or elegant) due to how involved parties are disjointed. The storage is built by using ChainSpec instance within Both The other solution to this problem, which seems more appropriate for me, could be runtime-cache shared (kinda static instance) across multiply instances of @koute do you think shared-cache makes sense, and is doable? |
backtrace for reference
|
We had this and we don't want to go back there. polkadot-sdk/substrate/client/service/src/builder.rs Lines 147 to 148 in 12e5e19
We need to solve this here. There could be for example an extra method to |
I spent some time on this. @tmpolaczyk another idea: maybe you could use raw chainspec in your tests to avoid double compilation if that is a huge pain? |
I did not think about that, but we use Anyway this is not urgent, I managed to improve our test time by using #1641, so now instead of compiling the wasm twice we only compile it once (because of this bug, after it is fixed we are going to use the precompiled wasm only). I liked your idea about a global instance cache, I may implement it in our fork if this doesn't get fixed. But I agree that a proper solution would be to change the api here, this way as a parachain we don't need any strange hacks and everything works as expected. Not sure how to do it though. |
Is there an existing issue?
Experiencing problems? Have you tried our Stack Exchange first?
Motivation
After upgrading to polkadot 1.6.0 in tanssi (moondance-labs/tanssi@c427348), we noticed that typescript
dev_tests
take twice as long now. These tests runtanssi-node --dev
for each test, so the issue was that starting a new node was taking longer than before. The cause seems to be the wasm compilation, which takes a considerable amount of time.After some debugging, it looks like the runtime wasm is being compiled 3 times. One of the redundant ones is fixed by #3447, and the other is this one.
Calling
GenesisConfigBuilderRuntimeCaller::new()
always creates a new executor. This seems to ignore the wasm cache, and in the end this causes the wasm runtime to be compiled twice.Request
Add a method like
GenesisConfigBuilderRuntimeCaller::with_executor
or similar, to allow the user to pass an executor. Use that method inGenesisBlockBuilder::new()
, which already has access to the user executor.GenesisConfigBuilderRuntimeCaller
should use that executor instead of creating a new one.Maybe relevant: #2188
Solution
No response
Are you willing to help with this request?
Yes!
The text was updated successfully, but these errors were encountered: