TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Disabling npm's progress bar yields a 2x npm install speed improvement

544 pointsby ishtuover 9 years ago

24 comments

ClayFergusonover 9 years ago
Doing GUI calls is a notorious way to slow down apps. I sped up an app (major software from major large corporation) by a factor of 10x a few years back by removing GUI updates. What you have to do is create a thread that refreshes the GUI periodically and not let your main worker thread ever work on the GUI. This particular app was an Eclipse Plugin (a source control app) and the Eclipse SWT to update the console log window was being called after every file operation (of which there were 10s of thousands). All I did was move the GUI refreshing into it's own thread, and call it only every 250millis or so. I was hailed a hero, and deservedly so, for speeding up our app by 10X and was one of my most satisfying accomplishments in my software career.
评论 #10977670 未加载
评论 #10977943 未加载
评论 #10977661 未加载
评论 #10981887 未加载
评论 #10977845 未加载
评论 #10979931 未加载
untogover 9 years ago
Progress bar or not, npm has gotten extremely slow with v3, to the extent that someone is working on a performance-centered alternative called ied:<p><a href="http:&#x2F;&#x2F;gugel.io&#x2F;ied&#x2F;" rel="nofollow">http:&#x2F;&#x2F;gugel.io&#x2F;ied&#x2F;</a><p>installs are literally the #1 thing npm needs to do well, and I really hope we see some improvement soon.
评论 #10976234 未加载
评论 #10978256 未加载
评论 #10978774 未加载
评论 #10976191 未加载
ghjnutover 9 years ago
Here&#x27;s a breakdown <a href="https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;issues&#x2F;11283#issuecomment-175246823" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;issues&#x2F;11283#issuecomment-1752468...</a>
评论 #10976805 未加载
nijikoover 9 years ago
I&#x27;d also like to take the time to mention that the caching system when installing &#x2F; other actions is extremely inefficient (for my times I have the progress bar turned off already and this is a project with around 80 modules shared between dev &#x2F; prod):<p><a href="https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;issues&#x2F;10890" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;issues&#x2F;10890</a><p>I started on a very (I would like to emphasize very a thousand times over) basic proof-of-concept to show how much faster it could be in the order of magnitudes:<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;nijikokun&#x2F;2f1f16325f8ffe14b1b3" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;nijikokun&#x2F;2f1f16325f8ffe14b1b3</a><p>All this does is build a json of every package you currently have installed, and utilizes that as a lookup store the next time instead of rebuilding it every install; this was targeted towards installing &#x2F; uninstalling existing packages. Not fresh installs.<p>Fresh installs would benefit from bulk lookups via the API imo.
评论 #10977121 未加载
gavinjoyceover 9 years ago
Some further details on the issue: <a href="https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;issues&#x2F;11283" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;npm&#x2F;npm&#x2F;issues&#x2F;11283</a>
评论 #10976542 未加载
评论 #10976147 未加载
hharnischover 9 years ago
It&#x27;s all good, Laurie fixed it - <a href="https:&#x2F;&#x2F;twitter.com&#x2F;seldo&#x2F;status&#x2F;692192238445711360" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;seldo&#x2F;status&#x2F;692192238445711360</a>
评论 #10978374 未加载
TazeTSchnitzelover 9 years ago
Two years ago, PHP&#x27;s package manager, Composer, was sped up by disabling the garbage collector:<p><a href="http:&#x2F;&#x2F;blog.ircmaxell.com&#x2F;2014&#x2F;12&#x2F;what-about-garbage.html" rel="nofollow">http:&#x2F;&#x2F;blog.ircmaxell.com&#x2F;2014&#x2F;12&#x2F;what-about-garbage.html</a><p>(Or more accurately the cycle collector. You can&#x27;t turn off reference counting.)
freshyillover 9 years ago
I posted this below, but I&#x27;ll post again here for visibility. What the heck is up with npm install on iTerm 2? I had no idea something was weird until recently, when I did an install with Termial.<p>Here&#x27;s a side-by-side video: <a href="https:&#x2F;&#x2F;youtu.be&#x2F;odoVfHHBYVM" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;odoVfHHBYVM</a>
评论 #10977857 未加载
评论 #10977584 未加载
Tooover 9 years ago
The funky progress bar is about the coolest thing with npm. They could let it take a minute if they wanted too and i would keep watching it with amazement.
评论 #10976265 未加载
评论 #10976238 未加载
评论 #10977060 未加载
teknologistover 9 years ago
I work in China. Downloading from the outer Internet will never match the speed of writing to the console. Not too worried
评论 #10977978 未加载
maaaatsover 9 years ago
Could it be linked with the terminal being used?<p>Edit, reminds me of this, which is why I&#x27;m wondering <a href="http:&#x2F;&#x2F;stackoverflow.com&#x2F;q&#x2F;21947452&#x2F;923847" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;q&#x2F;21947452&#x2F;923847</a>
libeclipseover 9 years ago
This makes sense. It&#x27;s like when I&#x27;m solving a project euler problem, I don&#x27;t use verbose output because it runs much faster without having to print everything to the screen. (Python)
评论 #10976840 未加载
BuckRogersover 9 years ago
I don&#x27;t know the exact cause here, but I can say I&#x27;m thankful for my systems background that I&#x27;ve gleamed for years before moving into programming. Most sysadmin types know that displaying output on a filecopy slows down transfers greatly because the screen vsync holds up the operation.<p>When I write utilities today that do similar things, I only display output when writing and testing the program. Otherwise I&#x27;ll write to memory then dump the results in a logfile at the end.<p>In this case since there is probably a less intensive way of providing status updates, and can probably be resolved by doing intermittent checks.
bechampionover 9 years ago
Someone with more UI development can comment here , but i always thought progress bars where more like a signal to the user that &quot;something is being done&quot; , and not a representation of how much is done and how much is left.
评论 #10979355 未加载
swangover 9 years ago
I don&#x27;t see this at all, what&#x27;s more worrying is that npm 3.* is apparently way slower than npm 2.*<p>I did this test on a npm library I wrote, installs some test tools and also has to compile some gyp stuff<p>2.14.2<p>progress=false real 0m26.589s user 0m12.086s sys 0m3.362s<p>progress=true real 0m29.553s user 0m12.455s sys 0m3.486s<p>3.5.2<p>progress=false real 0m57.489s user 0m13.298s sys 0m3.421s<p>progress=true real 1m1.084s user 0m15.690s sys 0m3.644s<p>While I don&#x27;t see any significant difference between progress bars or none for 3.x, what is 3.x doing that causes almost 30 seconds more churning?
评论 #10976116 未加载
mannykannotover 9 years ago
I used to joke, in the context of virus scanning, that I could give you a more accurate progress bar, but the scan would take twice as long...
aidenn0over 9 years ago
sbcl&#x27;s compilation output is so verbose that the compilation instructions mention that it builds faster on xterm than gnome-terminal
dannypghover 9 years ago
Yes, but, which download feels longer?
ferdamravenecover 9 years ago
Another product bitten by the dark side of progress indicators.<p>One of the most often underestimated areas of product development, though certainly not among the most important underestimates.<p>Easy to underestimate its cost and impact. After all, it&#x27;s just a progress indicator.
bitwarriorover 9 years ago
...has he controlled for network speed? Unless he&#x27;s set up a local NPM caching proxy, he&#x27;s going over the &#x27;net for these packages. It&#x27;ll take more than 1 datum before I believe this hype.
评论 #10976186 未加载
评论 #10976235 未加载
评论 #10976240 未加载
ww520over 9 years ago
Screen IO is slow. A trick to speed up unzip speed, do unzip -qq. That skips all the screen output and make it flies.
mericover 9 years ago
That&#x27;s the biggest issue I have with the new npm. I wonder how many developer-days it has wasted already.
morebettererover 9 years ago
Upon first seeing npm 3.x I immediately added `--progress false --color false` to my npm installs and never looked back. Color and terminal graphics are the work of the devil.
评论 #10976348 未加载
dschiptsovover 9 years ago
Well-designed server platform.
评论 #10978317 未加载