1. require-so-slow
`require`s taking too much time? Profile 'em.
require-so-slow
Package: require-so-slow
Created by: ofrobots
Last modified: Sun, 15 May 2022 20:25:58 GMT
Version: 2.0.5
License: Apache-2.0
Downloads: 2,524
Repository: https://github.com/ofrobots/require-so-slow

Install

npm install require-so-slow
yarn add require-so-slow

require-so-slow

  • Wondering why your applications is slow to start?
  • require seems to take an eternity?
  • Wonder no more!

This module produces a timeline of your requires and produces an output
that you can load in the Chrome Timeline Viewer.

Trace Viewer

Click on the image above to go see an interactive version.

Command Line Usage

 # Profiles the timeline of requiring `request@latest` and generates a trace
# output file you can load in Chrome Timeline viewer [1]
$ npx require-so-slow request

# You can specify specific versions or dist-tags.
$ npx require-so-slow [email protected]
$ npx require-so-slow got@rc

# You can specify what output filename to use:
$ npm require-so-slow -o lodash.trace.json lodash

You can also preload require-so-slow from node:

 npm i -D require-so-slow

# Traces the entire execution of entrypoint and writes to
# ./require-so-slow.trace by default
$ node -r require-so-slow [entrypoint]

# The output path can be changed with the TRACE_OUTFILE environent variable

API

 const requireSoSlow = require('require-so-slow');

// load stuff, run stuff.
require('request');

// Write a trace file at some point.
requireSoSlow.write('require-trace.trace');

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code