Git Product home page Git Product logo

node-repeated-dynamic-imports's Introduction

Run node test.mjs to run the benchmark against two cases:

  1. A createCachedImport() function that caches the result of dynamic imports manually.
  2. Simply call await import() directly and rely on the runtime cache.

The result locally (MacOS M1 Pro, Node.js v20.12.2):

┌─────────┬─────────────────┬─────────────┬────────────────────┬──────────┬─────────┐
│ (index) │ Task Name       │ ops/sec     │ Average Time (ns)  │ Margin   │ Samples │
├─────────┼─────────────────┼─────────────┼────────────────────┼──────────┼─────────┤
│ 0       │ 'manual cached' │ '5,116,888' │ 195.43127172950625 │ '±0.74%' │ 2558445 │
│ 1       │ 'nodejs'        │ '863,698'   │ 1157.81171239986   │ '±0.48%' │ 431850  │
└─────────┴─────────────────┴─────────────┴────────────────────┴──────────┴─────────┘
Result with Node.js v18.18.2 (node20 had significant improvements)
┌─────────┬─────────────────┬─────────────┬───────────────────┬──────────┬─────────┐
│ (index) │    Task Name    │   ops/sec   │ Average Time (ns) │  Margin  │ Samples │
├─────────┼─────────────────┼─────────────┼───────────────────┼──────────┼─────────┤
│    0    │ 'manual cached' │ '5,153,790' │  194.03193033114  │ '±0.94%' │ 2576896 │
│    1    │    'nodejs'     │  '85,838'   │ 11649.79618615562 │ '±0.51%' │  42920  │
└─────────┴─────────────────┴─────────────┴───────────────────┴──────────┴─────────┘

node-repeated-dynamic-imports's People

Contributors

bluwy avatar

Watchers

 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.