#Different contract size different computer
39 messages · Page 1 of 1 (latest)
are there any default settings from system env?
Is this pre or post optimization?
Post, but even pre optimization the diff is about the same. 29K and 15K.
I have an intel mac, I'd be happy to give it a shot and see if that varies too
Both systems have synchronized system environment via a git repo that's identical on both, so the bash setup and env vars are the same. These are the only Rust and Cargo params.
CARGO_UNSTABLE_SPARSE_REGISTRY=true
RUSTUP_INIT_SKIP_PATH_CHECK=yes
RUSTC_WRAPPER=/opt/homebrew/bin/sccache
Oh, it's possible sccache is newer on the M2...
Oh wow, 0.3.3 vs 0.5.3.
Upgrading both to 0.5.4 made no difference.
@halcyon timber Do you have any tips for how to debug something like this? Is there a way for me to see if LTO is actually running?
The repo is https://github.com/leighmcculloch/soroban-webauthn. You need to have soroban-cli installed, then run make build. The command being run you can see in the Makefile.
I'm using soroban-cli v20.0.0-rc3.
Both mac's are running macOS Sonoma 14.0.
Will upgrade cli. I'm on ventura still tho. One sec while i go clone and build everything
It's a tiny contract.
Although it does a little JSON decoding in the contract 😬. But the contract and deps are pretty light.
Writing to: ./out/webauthn_account_ed25519.optimized.wasm...
Optimized: ./out/webauthn_account_ed25519.optimized.wasm (25327 bytes)
-rw-r--r-- 1 mootz12 staff 25K Oct 9 13:55 ./out/webauthn_account_ed25519.optimized.wasm
-rwxr-xr-x 1 mootz12 staff 29K Oct 9 13:55 ./out/webauthn_account_ed25519.wasm```
That's the same as what I get on my M1 Max.
if it matters, I don't have deno installed on my machine, nor do I think I have sccache
That shouldn't matter. Sccache just caches Rust artifacts so that builds of the same inputs across multiple repos are shared. If anything it'd be more likely to cause a problem than make everything smaller.
If anyone else has an Apple M2, would be interesting to see if there's something there. Otherwise, maybe I can rent out compile time on my laptop 😂
Have you tested this on other contracts? Does the smaller one still work?
We could test against Blend, as it has a few WASM based integration tests too.
cc: @fast inlet (you have an M2, right?)
No I've got a M1
ah, my bad! sorry!
No problem!
I've tried Windows just for fun and got 29K non-optimized. I've noticed this in the Wasm though:
Stream ended while parsing JSON Ð C:\Users\dmytr\.cargo\registry\src\index.crates.io-6f17d22bba15001f\microjson-0.1.2\src\lib.rs. it's pretty suspicious that compiler embeds some local paths into output (could be a red herring though...)
It must be related to the compiler build for different architectures? Maybe theres a setting to use relative paths instead. Do u have the same cargo.toml with the same build options set
I'm seeing the same thing on my WASM
I have an M1 Max and got 12,721 bytes on the optimized
Maybe this has something to do with the microjson dependency I'm pulling in.
I looked through its code and it has no deps, and has no cfg's based on host architecture, so maybe not.
I'm concerned this is something like LTO isn't running properly. cc @halcyon timber
Well I guess this means it is not an M2 thing.
It still works. I've got an integration test that loads the wasm file and tests it.
Are you using the same version of rustc on both computers
Yup 1.73.0
And the build configs the same? What other deps does cargo require. Could it be something like with gcc theres that posix flag for example