npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

v8-compile-cache

v2.4.0

Published

Require hook for automatic V8 compile cache persistence

Downloads

55,185,733

Readme

v8-compile-cache

Build Status

v8-compile-cache attaches a require hook to use V8's code cache to speed up instantiation time. The "code cache" is the work of parsing and compiling done by V8.

The ability to tap into V8 to produce/consume this cache was introduced in Node v5.7.0.

Usage

  1. Add the dependency:
$ npm install --save v8-compile-cache
  1. Then, in your entry module add:
require('v8-compile-cache');

Requiring v8-compile-cache in Node <5.7.0 is a noop – but you need at least Node 4.0.0 to support the ES2015 syntax used by v8-compile-cache.

Options

Set the environment variable DISABLE_V8_COMPILE_CACHE=1 to disable the cache.

Cache directory is defined by environment variable V8_COMPILE_CACHE_CACHE_DIR or defaults to <os.tmpdir()>/v8-compile-cache-<V8_VERSION>.

Internals

Cache files are suffixed .BLOB and .MAP corresponding to the entry module that required v8-compile-cache. The cache is entry module specific because it is faster to load the entire code cache into memory at once, than it is to read it from disk on a file-by-file basis.

Benchmarks

See https://github.com/zertosh/v8-compile-cache/tree/master/bench.

Load Times:

| Module | Without Cache | With Cache | | ---------------- | -------------:| ----------:| | babel-core | 218ms | 185ms | | yarn | 153ms | 113ms | | yarn (bundled) | 228ms | 105ms |

^ Includes the overhead of loading the cache itself.

Acknowledgements

  • FileSystemBlobStore and NativeCompileCache are based on Atom's implementation of their v8 compile cache:
    • https://github.com/atom/atom/blob/b0d7a8a/src/file-system-blob-store.js
    • https://github.com/atom/atom/blob/b0d7a8a/src/native-compile-cache.js
  • mkdirpSync is based on:
    • https://github.com/substack/node-mkdirp/blob/f2003bb/index.js#L55-L98