-
Notifications
You must be signed in to change notification settings - Fork 17.4k
Introduce scheme to npm dedupe
npm dependencies of Atom packages
#8217
Comments
This is definitely true, especially on Windows, calling |
We could de-dupe modules common to all packages by storing them in This really makes me wonder about doing something that isn't based on the file system in terms of reusing required modules across the entire application. The problem with such a change is it breaks the simple semantics of Node's |
Hmm, if we had:
as a symlink to (that was created via
would it look in The thing I dislike about that is that while in the process of going from v0.0.26 to v0.0.27, the versions of our |
@nathansobo Is there any way that third-party packages can leverage asar bundles to get some sort of benefit? |
I haven't investigated but it sounds promising. @kevinsawicki would have more information about what it would take to create an asar bundle for multiple or individual packages. |
Why don't you check for an existing npm package that matches during your install? If the version check passes, use the existing module, if not run apm install. I've also run into similar issues where I need to use different versions of some packages and the same on others. I created a symlink between folders so the program didn't know it was checking another folder. |
@methodbox The problem is that if you are using another package's npm dependency, and that package upgrades itself, it could break you, no? |
any updates? |
Not trying to beat a known horse (src install should work, right), but I'm running into install time far longer than 6 mins due to capped I/O when trying nuclide-installer. Although it hasn't fully installed yet, its happening on Windows 10 via Atom GUI. I started the install at aprx ~10:20am, and now it's a little over halfway done at ~11:40am. Considering its mentioned that there are only 17 packages within that meta plugin, this seems wonked. "Evented I/O for V8 JavaScript (32 bit)" seems to be the culprit using 100% disk. Im seeing it cap out above 6 MB/s with a sustained CPU between 30-80%. Considering this is a spinner drive (100+gb free), its very much affecting the performance of the whole PC. Albeit it non SSD, this is a 64bit 8gb 3k machine, it's not like it's too underpowered to run an editor. I concur it's all the files in nuclide-installer meta, although perhaps Evented I/O running 32bit instead of 64bit could compound that effect. EDIT: after installing, Atom crashes out totally spikes I/O way higher peaking 15 MB/s |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks! |
Currently, the organization of the
~/.atom/packages
directory makes it impossible to dedupe dependencies, potentially causing a lot of bloat.Specifically, in the case of Nuclide, we have our
nuclide-installer
package that is used to install our collection of Nuclide packages. In the most recent release of Nuclide (v0.0.26), there are 17 such packages to install: https://github.com/facebooknuclideapm/nuclide-installer/blob/v0.0.26/lib/config.json.The way
nuclide-installer
works is that it starts up and then runsapm install
for each package in thatconfig.json
file. On my machine (where~/.npm
was already populated with all of the dependencies used by these packages), it tooknuclide-installer
6 minutes to install all 17 Atom packages and the resulting~/.atom/packages
directory was 903M! That's enormous! This is bad for several reasons:~/.atom/packages
is not loaded as efficiently as the JavaScript in/Applications/Atom.app/Contents/Resources/app.asar
, putting third-party code at even more of a disadvantage.I suspect that the only thing I can do right now without any changes to Atom is have
~/.atom/nuclide-installer
create a special directory structure under itself. Maybe something like:where npm packages common to multiple Nuclide Atom packages would be written to
~/.atom/nuclide-installer/node_modules/
(obviously there could only be one version per common dependency) and then each Atom package would be in its own directory under~/.atom/nuclide-installer/node_modules/atom_packages/
. Under that scheme, only an npm dependency that already had an entry under~/.atom/nuclide-installer/node_modules/
would also have to exist under~/.atom/nuclide-installer/node_modules/atom_packages/<ATOM PACKAGE>/node_modules
if a different version were required.Once everything was in place,
nuclide-installer
would runapm link
for each entry in~/.atom/nuclide-installer/node_modules/atom_packages
.While I'm rubber ducking, I would probably add another directory of indirection so that the directory structure would be parameterized by version number:
This way,
nuclide-installer
could be writing out v0.0.27 and would not switch over until all of the files were in place.This is really important for Nuclide, so I'm willing to hack this into
nuclide-installer
, but it would be nice if there were a way for Atom to support this natively so that others could also provide package bundles efficiently for Atom.The text was updated successfully, but these errors were encountered: