Code Monkey home page Code Monkey logo

wasm-benchmark's Introduction

WebAssembly benchmark

Benchmark Rust WebAssembly vs. JavaScript

Installation

Docker

Build the image with

docker build -t wasm-benchmark .

For local development and testing, the container can easily been started by running

POSTGRES_PASSWORD=yourpassword docker compose up --build

Replace yourpassword with a random password for the database. This compose contains its own database, so you don't have to set it up yourself. The server appears at localhost:80.

Alternatively, to start the container in production, you have to pass DATABASE_URL environment variable holding postgres://... URL for the database. As an example, the start command could look something like this:

docker container run -p 80:80 -e DATABASE_URL=postgres://user:[email protected]:5432/mydb wasm-benchmark

Manual installation

To work with this project, you need to have Rust & Cargo and wasm-pack installed.

After cloning this repository run the following commands:

npm install
npx playwright install
npm run build

Create a file called .env and add your Postgres URL with key DATABASE_URL.

Then you can run the development server with

npm run dev         # frontend
npm run start:dev   # backend

or after running npm run build you can serve the production build with

npm start

Run npm run build after making changes to rust-lib/ to bring the changes to the server. Also run npm run build after any changes to update the production build.

Tests can be run as follows:

npm run test
npm run test:e2e
npm run lint
cargo test --manifest-path rust-lib/Cargo.toml

Finally, you can remove all compiled and derived files by running npm run clean.

Development

NPM dependencies are should be saved into correct category. Production dependencies are used by the backend. Development dependencies are only used by the frontend (not needed after building) and tests or they are development tools.

Licenses

JavaScript logo under MIT license from voodootikigod/logo.js.

Rust logo under CC-BY license from rust-lang/rust-artwork.

wasm-benchmark's People

Contributors

pyryl avatar

Watchers

Matti Luukkainen avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.