GithubHelp home page GithubHelp logo

micheleriva / c-vs-ts-wasm Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 41 KB

👽Simple repo I made for myself just to test some WebAssembly compilers.

License: MIT License

C 7.47% TypeScript 6.44% WebAssembly 70.13% Makefile 8.33% Haskell 7.63%
assembly c compilers cpp haskell typescript wasm wat webassembly

c-vs-ts-wasm's People

Contributors

micheleriva avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

c-vs-ts-wasm's Issues

Minor mismatch between AssemblyScript and C

Hi, glad to see someone try compare how different compilers produce wasm's binary.
But I should be mentioned in AS version you use number type which just alias of f64 instead int32 as in C version. So AS version should looks like:

function fibonacci(i: i32): i32 { // or i64
  if (i < 0) return -1
  else if (i == 0) return 0
  else if (i == 1) return 1
  else return fibonacci(i - 1) + fibonacci(i - 2)
}

Another issue is AS doesn't use optimization at all in your build command. So much better is:

"asbuild": "asc src/ts/main.ts -b src/ts/a.out.wasm -t src/ts/a.out.wat --validate --measure -O3"

Thanks!

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.