Skip to content

Minimalistic app to compare computation impact on UI while using WASM function, Web Workers and standard JS code

Notifications You must be signed in to change notification settings

Oyoshi/web-workers-wasm-example

Repository files navigation

Web Workers & WASM Example

Comparision of three ways of handling computationally expensive procedures. In this example we're basing on no optimized recursive algorithm for calculating n-th Fibonacci number. While doing this computation in standard way for "big" numbers (greater than 40) the whole UI is blocked and not responsive. On the other hand by using Web Worker we're able to run this computation in the background. As a result the UI is fully responsive. Additionaly we're also using function written in Rust and compiled to WASM. Again, for the quite "big" numbers time of computation is far better for WASM code instead of JS.

Demo

Demo is available here. CI/CD has been configured to automatically deploy any changes using firebase CLI.

Build & Run 👷

Local

yarn build:wasm
yarn install
yarn start

Docker

Type docker-compose up -d and then navigate to http://localhost:8080/.

Unit Tests ⚠️

UTs are failing because of problem with imported WASM function.

About

Minimalistic app to compare computation impact on UI while using WASM function, Web Workers and standard JS code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published