3.0.1 • Published 2 years ago

v8-compile-cache-lib v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

v8-compile-cache-lib

Fork of v8-compile-cache exposed as an API for programmatic usage in other libraries and tools.


Build status

v8-compile-cache-lib 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-lib
  2. Then, in your entry module add:

    require('v8-compile-cache-lib').install();

.install() 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-lib.

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-lib. 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/cspotcode/v8-compile-cache-lib/tree/master/bench.

Load Times:

ModuleWithout CacheWith Cache
babel-core218ms185ms
yarn153ms113ms
yarn (bundled)228ms105ms

^ Includes the overhead of loading the cache itself.

Acknowledgements

ts-node@xrnoz/ts-nodecuc-gafeasy-select-rntypes-gisreact-native-shekhar-bridge-test@oiti/documentoscopy-react-nativequoc-test@infinitebrahmanuniverse/nolb-v8luminos-ui-core@everything-registry/sub-chunk-3038jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgreact-native-jawwy_samplek0mmand3rhong1-utilskhaled-salem-custom-componentskns-error-codegogency-test-2gogencyjeopardyconverterjordy-frijters-test-liblog4debugnode-ph-locationsnglogger-acefonemollu-lang-webjrennsoh88-react-native-scroll-indicatornative-date-picker-modulenative-modal-damage-vehiclenew-awesome-4321notion-database-exporterjawwy_library_newjawy_library_v1gamification-jawwy-libraryframework_test_library_sixdee_new_jawwyfluent.adflow.reactnativesdkfluent.adflow.reactnativesdk-alphafront-end-engineeringgrandline-cligaurav-react-native-loopgriffin-ui-librarygundam5hamza_atmhardhat-teaplughardhat-teaxyzfalbit-utilsfawaterak-online-paymentfawatrak-online-paymentframework_test_library_sixdeeframework_test_library_sixdee_newframework_test_library_sixdee_new_newfrdrk-js-semaphoregenz-native-elementsevanutilsfmslgamification-integration-newewm-dico-enginenoodee@parallelnft/web3modalport-typesproject-wajs-dvreact-native-app-bubblereact-native-app-integrity-checksumreact-native-azure-communication-servicesreact-native-basic-appreact-native-basic-screenreact-native-auth-service-clientreact-native-aventonfacetec-aventonreact-native-awesome-android-123react-native-awesome-android-123-zeotapreact-native-awesome-module-latestreact-native-awesome-module-tworeact-native-animate-textreact-native-android-video-player-viewreact-native-bleccs-componentsreact-native-dimensions-layoutreact-native-bridge-packagereact-native-bluetooth-device-detectreact-native-ctp-odpreact-native-fedlight-dsmreact-native-get-countriesreact-native-ghn-ekycreact-native-dhp-printerreact-native-conekta-card-tokenizerreact-native-components-designreact-native-arps-authorize-netreact-native-check-componentreact-native-chenaarreact-native-build-vesion-getterreact-native-additionreact-native-rn-icons-libraryreact-native-rn-appreact-native-shared-gesturereact-native-onrampreact-native-rabbitmq-allreact-native-screen-idle-timer
3.0.1

2 years ago

3.0.0

3 years ago