Skip to content

evertondanilo/rustComparisons

Repository files navigation

Rust WebAssembly vs JavaScript

A tool for compare and contrast the performance of algorithms in Rust WASM and JS languages.

This project is part of a thesis presented for the degree of MSc In Software Solutions Architecture @ Technological University of Dublin (IT Tallaght)

Description

The objective of the research is to compare and contrast the performance of multiple algorithms written in JavaScript and Rust WebAssembly versions in terms of Execution Time and Memory Consumption.

License

Licensed under either of

at your option.

Getting Started

Following is the setup to run the benchmark tool.
You will need to run these steps with administrator privileges.

Dependencies

  • nodeJS
  • http-server installed globally:
npm install http-server -g
  • Rust and its compiler tools at:
    https://www.rust-lang.org/tools/install
  • check whether rust is installed:
rustc --version
  • You might want to play with rust before going into this project:
    https://www.rust-lang.org/learn/get-started

Installing

These steps setup cargo and WASM tools. They are available at:
https://rustwasm.github.io/docs/book/game-of-life/setup.html

  1. Install wasm-pack for building, testing, and publishing Rust-generated WebAssembly:
    https://rustwasm.github.io/wasm-pack/installer/
  2. Install cargo-generate with this command:
    cargo install cargo-generate
    
  3. If you already have npm installed, make sure it is up to date with this command:
    npm install npm@latest -g
    
  4. Inside rustComparisons\www folder execute:
    npm ci
    

Executing program in Development Mode

  • To build WASM package,
  • From rustComparisons folder execute:
wasm-pack build; $env:rust_test_mode='1'; cargo test;
  • To run the tool,
  • From rustComparisons\www folder execute:
npm test; npm start
  • Access the URL:
    http://localhost:8080/

Executing program in Production Mode

  • To build WASM package,
  • From rustComparisons folder execute:
wasm-pack build --profiling
  • To build WWW package,
  • From rustComparisons\www folder execute:
npm run build
  • Then run site execute:
npm run static
  • Access the URL:
    http://localhost:8080/

Running unit tests

  • From rustComparisons folder execute:
wasm-pack build; $env:rust_test_mode='1'; cargo test;
  • From rustComparisons\www folder execute:
npm test

Points of interest

About

A tool for compare and contrast the performance of algorithms in Rust WASM and JS languages.

Resources

License

Stars

Watchers

Forks