All Projects → shellscape → webpack-plugin-ramdisk

shellscape / webpack-plugin-ramdisk

Licence: MPL-2.0 License
🐏 A webpack plugin for blazing fast builds on a RAM disk / drive

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to webpack-plugin-ramdisk

zram manager
No description or website provided.
Stars: ✭ 41 (-65.25%)
Mutual labels:  ram, memory
memtester
Simple memory tester mirror from http://pyropus.ca/software/memtester/. Please note that I am not the author of Memtester
Stars: ✭ 84 (-28.81%)
Mutual labels:  ram, memory
Volatility
An advanced memory forensics framework
Stars: ✭ 5,042 (+4172.88%)
Mutual labels:  ram, memory
Xfce4 Genmon Scripts
🐭 XFCE panel generic monitor scripts
Stars: ✭ 69 (-41.53%)
Mutual labels:  disk, memory
stress
Single-purpose tools to stress resources
Stars: ✭ 24 (-79.66%)
Mutual labels:  disk, memory
Sysstat
Performance monitoring tools for Linux
Stars: ✭ 2,055 (+1641.53%)
Mutual labels:  disk, memory
Devspace
DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
Stars: ✭ 2,559 (+2068.64%)
Mutual labels:  development, dev
Cra Build Watch
A script for create-react-app that writes development builds to the disk
Stars: ✭ 110 (-6.78%)
Mutual labels:  development, disk
pug-server
🐶 A simple pug server
Stars: ✭ 19 (-83.9%)
Mutual labels:  development, dev
lessram
Pure PHP implementation of array data structures that use less memory.
Stars: ✭ 20 (-83.05%)
Mutual labels:  ram, memory
Heim
Cross-platform async library for system information fetching 🦀
Stars: ✭ 572 (+384.75%)
Mutual labels:  disk, memory
psutil
Cross-platform lib for process and system monitoring in Python
Stars: ✭ 8,488 (+7093.22%)
Mutual labels:  disk, memory
lethe
Secure drive wipe
Stars: ✭ 47 (-60.17%)
Mutual labels:  disk, drive
Tarantool
Get your data in RAM. Get compute close to data. Enjoy the performance.
Stars: ✭ 2,787 (+2261.86%)
Mutual labels:  disk, in-memory
Memfs
In-memory filesystem with Node's API
Stars: ✭ 854 (+623.73%)
Mutual labels:  memory, in-memory
go-disk-buffer
This package helps to work with huge amount of data, which cannot be stored in RAM
Stars: ✭ 39 (-66.95%)
Mutual labels:  ram, disk
retrocache
This library provides an easy way for configure retrofit for use a 2 layer cache (RAM and Disk)
Stars: ✭ 35 (-70.34%)
Mutual labels:  ram, disk
android-trinity
android-trinity is tiny proactive framework with much of the scaffolding code required to start a new Android Application.
Stars: ✭ 44 (-62.71%)
Mutual labels:  development, dev
incache
Powerful key/value in-memory storage or on disk to persist data
Stars: ✭ 16 (-86.44%)
Mutual labels:  in-memory
create-adapter
Command line utility to create customized ioBroker adapters
Stars: ✭ 39 (-66.95%)
Mutual labels:  development
webpack-plugin-ramdisk

tests cover size libera manifesto

webpack-plugin-ramdisk

🐏 A webpack plugin for blazing fast builds on a RAM disk / drive

Please consider donating if you find this project useful.

What It Does

This plugin will initialize and mount a RAM disk / drive to enable faster build emitting times. This has advantages over third-party in-memory filesystems in that it uses Node's fs module in conjunction with the local system's native capabilities. It's especially useful for projects which need to perform many successive builds, such as during development with Hot Module Reloading enabled. In an HMR scenario, this will also prevent excessive writes to Solid State Drives, preventing the shortening of the drive's lifespan.

Requirements

webpack-plugin-ramdisk is an evergreen 🌲 module.

This module requires an Active LTS Node version (v10.0.0+).

Install

Using npm:

npm install webpack-nano webpack-plugin-ramdisk --save-dev

Note: We recommend using webpack-nano, a very tiny, very clean webpack CLI.

Usage

When the plugin is applied during a webpack build, the output path specified for a compiler configuration is appended to the RAMdisk path. Be sure to choose an appropriate output path!

Create a webpack.config.js file:

const { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk');
const options = { ... };

module.exports = {
	// an example entry definition
	output: {
		path: '/myapp/dist'  // ← important: this must be an absolute path!
  }
  ...
  plugins: [
    new WebpackPluginRamdisk(options)
  ]
};

And run webpack:

$ npx wp

You'll then see that build output has been written to the RAMdisk. In our example above on a MacOS computer, the output path would be /Volumes/wpr/myapp/dist.

Options

blockSize

Type: Number
Default: 512

Sets the block size used when allocating space for the RAMdisk.

bytes

Type: Number
Default: 2.56e8

Sets the physical size of the RAMdisk, in bytes. The default value is 256mb. Most builds won't require nearly that amount, and the value can be lowered. For extremely large builds, this value may be increased as needed.

name

Type: String
Default: wpr

Sets the name of the disk/drive/mount point for the RAMdisk. e.g. A value of batman would result in a disk root of /Volumes/batman on MacOS and /mnt/batman on Linux variants.

API

WebpackPluginRamdisk.cleanup(diskPath)

Parameters: diskPathString The mounted path of the RAMdisk to unmount and remove

Static. Provides a convenience method to unmount and remove a RAMdisk created with the plugin.

To remove the RAMdisk that the plugin created, first obtain the diskPath from the plugin:

const { WebpackPluginRamdisk } = require('webpack-plugin-ramdisk');
const plugin = new WebpackPluginRamdisk(options)
const { diskPath } = plugin;

WebpackPluginRamdisk.cleanup(diskPath);

Use Caution as specifying the wrong diskPath can have unintended consequences and cause a loss of data. The commands this method utilize can remove other drives as well.

Linux Users

Automatic creation of a RAMdisk requires administrative permissions. During the build process you'll be prompted by sudo to enter your credentials.

Windows Users

Windows users that have installed Windows Subsystem for Linux v2 can use the module without issue.

However, Windows users without WSL2 are in a pickle. Unfortunately Windows does not ship with any capabilities that allow for creation of RAM disks / drives programmatically, without user interaction. This is an OS limitation and we cannot work around it. However, there is a solution for Windows users - tools like ImDisk will allow you to create a RAMdisk and assign it a drive letter, to which one can point a webpack configuration's output property.

Performance

Average savings for a bundle's total build time ranges from 25-32% according to tests we've run on a variety of platforms and bundle sizes. The largest gains were during frequently Hot Module Reloading operations, where one or more files were changed and the bundle(s) were rebuilt during watch mode.

For example, the following stats were generated for a 13mb bundle:

Without webpack-plugin-ramdisk:

  • initial build and emit: 19.88s
  • initial file change, save, and rebuild: 0.6s
  • subsequent changes and rebuilds: 1.15s 0.864s 1.68s

Average build and emit time: 1.23s

With webpack-plugin-ramdisk:

  • initial build and emit: 16.8s
  • initial file change, save, and rebuild: 0.9s
  • subsequent changes and rebuilds: 1.23s, 0.951s, 0.48s

Average build and emit time: 0.887s

Result = 28% time savings. This may seem inconsequential, but consider the number of times a single developer will save and rebuild for HMR during the course of a workday. When aggregated, that's a considerable savings throughout a session.

Removing the RAMdisk

These commands use wpr as the RAMdisk name. If the name option has been modified, swap wpr for the value specified in the options.

On MacOS:

$ umount /Volumes/wpr
$ hdiutil detach /Volumes/wpr

On Linux:

$ sudo umount /mnt/wpr

Meta

CONTRIBUTING

LICENSE (Mozilla Public License)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].