WebAssembly - Tutorial and Performance testing - [AssemblyScript to WASM]
Barely Coding with Daniel Bark
In this video I show the process of setting up AssemblysScript to WebAssembly compilation and how to test and evaluate the performance of placing computation in WASM compared to just using Javascript. AssemblyScript has the goal to provide TypeScript like syntax as much as possible and is therefore suitable for those that prefer to write Javascript and TS over alternatives like C, C++, Python, Go, Rust, Java, PHP, and so on. The functions covered in the video is a simple Add function, Factorials and Squaring all elements in an array. I also try to investigate the impact of passing large parameter payloads between JS and WASM and the glue code needed when passing more complex datatypes as parameters. Enjoy! :D
Full Code: https://github.com/danba340/assemblyscript-benchmarks
Setup from scratch steps: npm init -y npm install --save @assemblyscript/loader npm install --save-dev assemblyscript npx asinit . npm run asbuild
Twitter: https://twitter.com/BarelyDaniel Github: https://github.com/danba340
0:00 Intro 1:00 Files overview 2:53 Try the tests 3:30 Factorial AS 4:38 Factorial Test 5:30 Setting up Benchmark 9:30 Add & Factorial Benchmark 12:52 SquareArray AS 14:09 SquareArray Glue Code 17:52 SquareArray Test 19:30 SquareArray Benchmark 23:00 SquareArray no payload Benchmark 24:43 What did we learn? ... https://www.youtube.com/watch?v=gCT9ebtTzqw
175906824 Bytes