Coder Social home page Coder Social logo

Performance benchmark about mnemonist HOT 6 OPEN

yomguithereal avatar yomguithereal commented on May 18, 2024
Performance benchmark

from mnemonist.

Comments (6)

maxiruani avatar maxiruani commented on May 18, 2024

You should start the timer after creating the Trie

from mnemonist.

Yomguithereal avatar Yomguithereal commented on May 18, 2024

Hello @tomas-campodonico. Thanks for noticing this performance issue. I spotted an error in the Trie.get method and was able to get better performance (beating the ES5 array). Some things:

  1. @maxiruani is right, you should put your timer after creating the Trie.
  2. Try pulling the code & use the latest commit or wait for the npm release.
  3. Try increasing your number to 100000 (one more zero) and you'll see a better benefit of using the Trie.

So, on the matter of benchmarking, you are right, I should start to make some in the repo to spot those kind of things etc. Usually I use matcha to do so. What do you think?

from mnemonist.

Yomguithereal avatar Yomguithereal commented on May 18, 2024

v0.10.2 has been released with the related commit.

from mnemonist.

noopnik avatar noopnik commented on May 18, 2024

Same benchmark with 10000000 will failed on the Trie.from(words) line . v0.10.2, Node 7.4.0 .

from mnemonist.

Yomguithereal avatar Yomguithereal commented on May 18, 2024

Yes, but this is a memory issue. With 10M items node will run out of memory because the Trie needs to store pointers whereas a flat array is contiguous in memory.

from mnemonist.

Yomguithereal avatar Yomguithereal commented on May 18, 2024

This said, we can work together, if you want, to create a StaticTrie that could be stored in a flat array so it is more memory-efficient.

from mnemonist.

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.