cadence
cadence copied to clipboard
Use gopherJS instead of webassembly for @onflow/cadence-parser
Issue To Be Solved
Currently cadence parser is compiled for webassembly, but it can be more effectively can be compiled with gopherJS. [0]
I tried running with :
~/go/bin/gopherjs build --minify ./runtime/cmd/parse
result was 2.8M pure js file. ( I just had to change tags to js from wasm , code didn't require any change )
[0] https://github.com/gopherjs/gopherjs
Interesting, I did not know this exists! Does the resulting build work properly? What is the performance compared to the WebAssembly build?
@turbolent let me try to parse all mainnet contracts with both of them and compare performance and correctness in the weekend.
So far in my tests working fast and correct, but can be some edge cases
@turbolent I ran the tests ( though it was super tricky running both at the same time, so I separated and ran in 2 pass )
- webassembly is approx 6-7x faster on Safari (though slowest gopherJS parsed was around 800-900ms)
- I parsed around 600 contracts, there was no edge case
I think it can still worth to compile with gopherJS though, or at least can be another package.
Nice! It's funny how size almost 1:1 correlates with speed for this one.