Re:My failed attempt to shrink all NPM packages by 5%
by alt227 on Monday January 27, 2025 @08:39AM
(#42841026)
I feel massively increasing publish time is a valid reason not to push this though considering such small gains and who the gains apply to.
[ Parent
| on HN ]
Re:My failed attempt to shrink all NPM packages by 5%
by scott_w on Monday January 27, 2025 @09:09AM
(#42841277)
I agree, going from 1 second to 2.5 minutes is a huge negative change, in my opinion. I know publishing a package isn't something you do 10x a day but it's probably a big enough change that, were I doing it, I'd think the publish process is hanging and keep retrying it.
Re:My failed attempt to shrink all NPM packages by 5%
by pletnes on Monday January 27, 2025 @10:42AM
(#42842269)
If you’re working on the build process itself, you’ll notice it a lot!
Re:My failed attempt to shrink all NPM packages by 5%
by rererereferred on Monday January 27, 2025 @09:26AM
(#42841428)
Since it's backwards compatible, individual maintainers could enable it in their own pipeline if they don't have issues with the slowdown. It sounds like it could be a single flag in the publish command.
Re:My failed attempt to shrink all NPM packages by 5%
by michaelmior on Monday January 27, 2025 @10:24AM
(#42842051)
Probably not worth the added complexity, but in theory, the package could be published immediately with the existing compression and then in the background, replaced with the Zopfli-compressed version.
Re:My failed attempt to shrink all NPM packages by 5%
by Null-Set on Monday January 27, 2025 @10:30AM
(#42842136)
No, it can't because the checksums won't match.
Re:My failed attempt to shrink all NPM packages by 5%
by michaelmior on Monday January 27, 2025 @12:54PM
(#42843749)
I don't think that's actually a problem, but it would require continuing to host both versions (at distinct URLs) for any users who may have installed the package before the Zopfli-compressed version completed. Although I think you could also get around this by tracking whether the newly-released package was ever served by the API. If not, which is probably the common case, the old gzip-compressed version could be deleted.
Re:My failed attempt to shrink all NPM packages by 5%
by hiatus on Monday January 27, 2025 @10:36AM
(#42842200)
Wouldn't that result in a different checksum for package-lock.json?
Re:My failed attempt to shrink all NPM packages by 5%
by aja12 on Monday January 27, 2025 @01:14PM
(#42843974)
> Probably not worth the added complexity, but in theory, the package could be published immediately with the existing compression and then in the background, replaced with the Zopfli-compressed version.
Checksum matters aside, wouldn't that turn the 5% bandwidth savings into an almost double bandwidth increase though? IMHO, considering the complexity to even make it a build time option, the author made the right call.