Code Monkey home page Code Monkey logo

Comments (6)

kripken avatar kripken commented on August 24, 2024 3

I did some more careful measurements now, I see the following speedups when using wasm:

  • Multiply is 8-15% faster
  • Divide is 33-45% faster
  • Modulo is 45%-65% faster

(the range is from comparing on a bunch of different VMs).

I think this could be summarized as "slow operations like division are around twice as fast".

from long.js.

xtuc avatar xtuc commented on August 24, 2024 1

I guess there's also a performance gain, you could talk about it too.

from long.js.

dcodeIO avatar dcodeIO commented on August 24, 2024

Sure, why not :) Currently it's in the release notes only.

from long.js.

dcodeIO avatar dcodeIO commented on August 24, 2024

What do you think of adding this paragrapth below the API:


WebAssembly support

WebAssembly supports 64-bit integer arithmetic out of the box, hence a tiny WebAssembly module is used to compute operations like multiplication, division and remainder more efficiently (slow operations like division are around twice as fast), falling back to floating point based computations in JavaScript where WebAssembly is not yet supported, e.g., in older versions of node.

from long.js.

dcodeIO avatar dcodeIO commented on August 24, 2024

Alright, the updated paragraph above is in the README now. It's not possible to just switch the README on npm, though, so we'll have to wait for another version update. Maybe implementing ctz, clz, rotl, rotr (see #45) and maybe others might be a good cause :)

from long.js.

xtuc avatar xtuc commented on August 24, 2024

@dcodeIO I think this information is important enough to make a new release to update the README on npm (even if it's just a patch).

from long.js.

Related Issues (20)

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.