Code Monkey home page Code Monkey logo

webassembly-perf-test's Introduction

webAssembly-perf-test

A simple numeric performance comparison for WebAssembly vs. Javascript.

This repository contains code to compare the performance of the nbody benchmark from the Computer Language Benchmarks Game and some custom modifications for the javascript versions

The results from my machine are available on my blog.

Feel free to send me pull requests for any correction or improvements.

#How to run

The javascript versions can simply be run from the browser. You might want to start it via a simple web server (e.g. http-server .) and open the nbody.html file in each directory. There's no build step for javascript necessary.

The java version is compiled with javac nbody and run with java nbody 50000000. It's the Java #4 version from the Computer Language Benchmarks Game

The C versions in the c directory can be compiled with gcc -O3 nbody.c -o nbody and gcc -O3 -fomit-frame-pointer -march=native -mfpmath=sse -msse3 nbody_fastest.c -o nbody_fastest They are the original version and version #4.

The WebAsssembly version is compiled with emcc nbody.c -O3 -s WASM=1 -s SIDE_MODULE=1 -o nbody.wasm. You'll have to setup emscripten and binaryen as described on Compile Emscripten from Source

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.