I recently implemented minification of Javascript resources on Android, removing all comments and unnecessary whitespace, but not otherwise modifying the Javascript. This has reduced the size of the Chrome resources.pak file (and hence the Android APK) by 600KB. See https://codereview.chromium.org/2179033002/.
On desktop versions of Chrome I believe this would have a far greater effect (simply because there are many Javascript resources that are only included in desktop versions of Chrome), however the tool I am using to do the minification is the Closure compiler, which is a Java executable, so would require Java support on all build and development machines. Is it acceptable to add this requirement?
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
I believe we've seen evidence that smaller download size directly affects number of successful downloads. So I think that order of KB savings would be worthwhile.
Why do sheriffs need Java? I didn't need it on my last shift I don't think?
-Christian
I think it's worth noting that minified Javascript may actually increase the size of updates. Javascript normally doesn't change that much, however, if you change a few bytes at the top of a minified Javascript file, variable names for a significant chunk of the rest of the file may change. Since our update system (On desktop, at least) relies on deltas, this could theoretically result in bigger updates.
On Aug 10, 2016 5:02 AM, "Christian Biesinger" <cbies...@chromium.org> wrote:
Why do sheriffs need Java? I didn't need it on my last shift I don't think?
Because the presubmit if you touch a Java file (revert, disable a test) requires it. I guess you could skip all the checks but that seems pretty silly to avoid having Java when all sheriffs are Chrome engineers, and all Chrome engineers should be setup to build clank.
-Christian
--
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.
☆PhistucK
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
(from the right address)
We already have build configs which require Java, obviously. Minification doesn't seem like something which needs to be on in default build configs for developers (isn't Closure kind of slow?), so the state of the world wouldn't really change with respect to Java dependency.
Why not move forward with enabling minification behind a GN flag and then we can explore specific concerns over size and performance?
☆PhistucK
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
Nico - you are the only person, so far, who has explicitly objected to depending on Java; can you expand on your objection?
☆PhistucK
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
On Thu, Aug 11, 2016 at 1:25 AM, Anthony Berent <abe...@chromium.org> wrote:Nico - you are the only person, so far, who has explicitly objected to depending on Java; can you expand on your objection?I also object to installing Java. Especially on Windows, it's a horrible user experience.
To Scott's question about performance, minification should be a strict performance improvement with some rare exceptions. Obviously function inlining and whatnot that the closure compiler doest should be a performance improvement as well. I'd expect to see modest perf gains in js parsing and execution time.
--
What I know of the closure compiler is definitely dated. It used to. Of course, with type annotations it worked better though.
wrt debugging, doesn't source maps address that ? and i thought closure could produce source maps automatically.
On Mon, 15 Aug 2016 at 15:49 Mike Frysinger <vap...@chromium.org> wrote:wrt debugging, doesn't source maps address that ? and i thought closure could produce source maps automatically.Sadly no, at least not at the moment. The problem is that, before compiling the files we have to process the <include> and <if...> preprocessing statements that we use in these files, so what we are actually compiling are temporary files that may already be significantly different from the original sources, hence meaning that the source maps don't map to anything useful. I don't know if it would be possible to add a pass to the closure compiler to handle these while correctly maintaining the source maps (rather than preprocessing the files); however if it was this would probably be the best solution.
I am not sure I understand the complication here - source maps can be created with the sources (that are used for compilation) embedded within them (I am not sure Closure Compiler currently supports generating this, but I will check if it simplifies the approach). You could save the source map on a Google Cloud Storage bucket and point the minified files to those source maps.
Yeah, just invoking uglifyjs with node (like a lot of the web ecosystem do) seems pretty reasonable - but people are still going to have to install node I guess? We can probably manage to depend on a relatively old version and have the one in the ubuntu repos work, but mac/win i guess have to install from elsewhere..
On Mon, Aug 15, 2016 at 11:53 AM, Torne (Richard Coles) <to...@chromium.org> wrote:Yeah, just invoking uglifyjs with node (like a lot of the web ecosystem do) seems pretty reasonable - but people are still going to have to install node I guess? We can probably manage to depend on a relatively old version and have the one in the ubuntu repos work, but mac/win i guess have to install from elsewhere..In general we need node for a bunch of reasons, vulcanize, uglify, karma, etc. I don't think we want to depend on the system one, we should have it checked in to an infra repo and then we DEPS it in. We already do that for node_modules/ for various things.Separately: OpenJDK doesn't require a clickthrough license, but there don't appear to be ready-made binaries for it on windows/mac; it's under a sufficiently open license that Linux distros can build their own and package it, but the openjdk site mostly just directs people toward installing Oracle's JDK instead.On Mon, 15 Aug 2016 at 16:47 Dimitri Glazkov <dgla...@chromium.org> wrote:node.js-based minification sounds pretty appealing to me, at least in principle.
On Mon, Aug 15, 2016 at 8:55 AM, Elliott Sprehn <esp...@chromium.org> wrote:On Mon, Aug 15, 2016 at 11:53 AM, Torne (Richard Coles) <to...@chromium.org> wrote:Yeah, just invoking uglifyjs with node (like a lot of the web ecosystem do) seems pretty reasonable - but people are still going to have to install node I guess? We can probably manage to depend on a relatively old version and have the one in the ubuntu repos work, but mac/win i guess have to install from elsewhere..In general we need node for a bunch of reasons, vulcanize, uglify, karma, etc. I don't think we want to depend on the system one, we should have it checked in to an infra repo and then we DEPS it in. We already do that for node_modules/ for various things.Separately: OpenJDK doesn't require a clickthrough license, but there don't appear to be ready-made binaries for it on windows/mac; it's under a sufficiently open license that Linux distros can build their own and package it, but the openjdk site mostly just directs people toward installing Oracle's JDK instead.On Mon, 15 Aug 2016 at 16:47 Dimitri Glazkov <dgla...@chromium.org> wrote:node.js-based minification sounds pretty appealing to me, at least in principle.Adding to what dglazkov@ and esprehn@ have said: using node.js directly in the build toolchain would be immensely helpful for a number of reasons.1) The web is embracing node; one less language to learn if your build scripts or server are in the same language. All of Polymer's tools are in node, for instance (get polymer = bower, make it faster = vulcanize, CSP compliance = crisper, build = polybuild).This is relevant to Chrome because we show a number of important UIs in web technologies. Those UIs are often less modernly written/tooled than they could be because of pushback against node.2) Node often finishes before the JVM begins :P, especially for smaller tasks.3) Adding node to our build toolchain would reduce the size of our source checkout. We currently check in a bunch of locally-node-processed artifacts because we can't use node to build (we bower+crisp polymer and check it into third_party/polymer, we vulcanize downloads and soon history and check them in to chrome/browser/resources). We can't make the new settings page fast yet because each grit <if> would need it's own precompiled bundle, and we really don't want check in 600KB x each variable in an <if> (i.e. mac, linux, chromeos, _google_chrome, etc.).4) If we decide to use a node.js-based minifier, it'd save us 200KB in on-disk space quickly (probably with source map support) by running it on the History and Downloads vulcanize bundles.
On Mon, Aug 15, 2016 at 8:55 AM, Elliott Sprehn <esp...@chromium.org> wrote:On Mon, Aug 15, 2016 at 11:53 AM, Torne (Richard Coles) <to...@chromium.org> wrote:Yeah, just invoking uglifyjs with node (like a lot of the web ecosystem do) seems pretty reasonable - but people are still going to have to install node I guess? We can probably manage to depend on a relatively old version and have the one in the ubuntu repos work, but mac/win i guess have to install from elsewhere..In general we need node for a bunch of reasons, vulcanize, uglify, karma, etc. I don't think we want to depend on the system one, we should have it checked in to an infra repo and then we DEPS it in. We already do that for node_modules/ for various things.Separately: OpenJDK doesn't require a clickthrough license, but there don't appear to be ready-made binaries for it on windows/mac; it's under a sufficiently open license that Linux distros can build their own and package it, but the openjdk site mostly just directs people toward installing Oracle's JDK instead.On Mon, 15 Aug 2016 at 16:47 Dimitri Glazkov <dgla...@chromium.org> wrote:node.js-based minification sounds pretty appealing to me, at least in principle.Adding to what dglazkov@ and esprehn@ have said: using node.js directly in the build toolchain would be immensely helpful for a number of reasons.1) The web is embracing node; one less language to learn if your build scripts or server are in the same language. All of Polymer's tools are in node, for instance (get polymer = bower, make it faster = vulcanize, CSP compliance = crisper, build = polybuild).This is relevant to Chrome because we show a number of important UIs in web technologies. Those UIs are often less modernly written/tooled than they could be because of pushback against node.2) Node often finishes before the JVM begins :P, especially for smaller tasks.3) Adding node to our build toolchain would reduce the size of our source checkout. We currently check in a bunch of locally-node-processed artifacts because we can't use node to build (we bower+crisp polymer and check it into third_party/polymer, we vulcanize downloads and soon history and check them in to chrome/browser/resources). We can't make the new settings page fast yet because each grit <if> would need it's own precompiled bundle, and we really don't want check in 600KB x each variable in an <if> (i.e. mac, linux, chromeos, _google_chrome, etc.).
4) If we decide to use a node.js-based minifier, it'd save us 200KB in on-disk space quickly (probably with source map support) by running it on the History and Downloads vulcanize bundles.The WebUI team is working on a larger list of reasons why node.js would be useful, and a list of responses to those that have objected in the past (lots has changed over the last couple years). I hope to follow up with that soon (next couple days), we're just full investigating some options to things like vulcanize (server push, for example) to hone what we'd need node for.
On Tue, Aug 16, 2016 at 12:12 PM, Dan Beam <db...@chromium.org> wrote:On Mon, Aug 15, 2016 at 8:55 AM, Elliott Sprehn <esp...@chromium.org> wrote:On Mon, Aug 15, 2016 at 11:53 AM, Torne (Richard Coles) <to...@chromium.org> wrote:Yeah, just invoking uglifyjs with node (like a lot of the web ecosystem do) seems pretty reasonable - but people are still going to have to install node I guess? We can probably manage to depend on a relatively old version and have the one in the ubuntu repos work, but mac/win i guess have to install from elsewhere..In general we need node for a bunch of reasons, vulcanize, uglify, karma, etc. I don't think we want to depend on the system one, we should have it checked in to an infra repo and then we DEPS it in. We already do that for node_modules/ for various things.Separately: OpenJDK doesn't require a clickthrough license, but there don't appear to be ready-made binaries for it on windows/mac; it's under a sufficiently open license that Linux distros can build their own and package it, but the openjdk site mostly just directs people toward installing Oracle's JDK instead.On Mon, 15 Aug 2016 at 16:47 Dimitri Glazkov <dgla...@chromium.org> wrote:node.js-based minification sounds pretty appealing to me, at least in principle.Adding to what dglazkov@ and esprehn@ have said: using node.js directly in the build toolchain would be immensely helpful for a number of reasons.1) The web is embracing node; one less language to learn if your build scripts or server are in the same language. All of Polymer's tools are in node, for instance (get polymer = bower, make it faster = vulcanize, CSP compliance = crisper, build = polybuild).This is relevant to Chrome because we show a number of important UIs in web technologies. Those UIs are often less modernly written/tooled than they could be because of pushback against node.2) Node often finishes before the JVM begins :P, especially for smaller tasks.3) Adding node to our build toolchain would reduce the size of our source checkout. We currently check in a bunch of locally-node-processed artifacts because we can't use node to build (we bower+crisp polymer and check it into third_party/polymer, we vulcanize downloads and soon history and check them in to chrome/browser/resources). We can't make the new settings page fast yet because each grit <if> would need it's own precompiled bundle, and we really don't want check in 600KB x each variable in an <if> (i.e. mac, linux, chromeos, _google_chrome, etc.).Given that we'd have to bundle Node as part of our checkout dependencies, would we really save enough space to offset the size increase for node itself?
4) If we decide to use a node.js-based minifier, it'd save us 200KB in on-disk space quickly (probably with source map support) by running it on the History and Downloads vulcanize bundles.The WebUI team is working on a larger list of reasons why node.js would be useful, and a list of responses to those that have objected in the past (lots has changed over the last couple years). I hope to follow up with that soon (next couple days), we're just full investigating some options to things like vulcanize (server push, for example) to hone what we'd need node for.I have no particular love for Node, but it does seem like the way thing are headed and my Node-enamored colleagues seem disinclined to use (the far preferable ;) Python instead, so I'm okay with us adding Node as long as we do it properly. And, I do think it would be better and more useful to require Node than it would be to require Java.I think we use Closure in the iOS build; can we use the Node version for that as well, so we can drop the Java requirement for iOS?
--
Yes.
<br class="m_-5117706417764818761m_45009514111447
Reviving this old-ish thread. Node has been added to the toolchain for quite a while now, and is being used to optimize (bundle) Polymer WebUI pages.I recently tried minifying Print Preview code with Uglify (which is not using Polymer). The result was a decrease of browser_resources.pak file from 2.8mb to 2.5mb, which seems non negligible to me, even though I suspect these are pre-gzipping gains.
If you think these are significant gains, let me know and I'll look into possibly cleaning my experiment CL and sending it for review.
Having said that, I realized that the usage of the <include> tag in Chromium's code to inline files at build time makes the use of other JS tools more complex (definitely a topic for a whole other thread). Eventually I would like to eliminate all usage of the custom <include> and use normal mechanisms like <script src="foo.js">, since <include> was relevant at a time where files could not be bundled together via other means, which is no longer the case. Either way, I'll probably start a new discussion on that when I have a more concrete plan on how to eliminate <include>.
On Fri, Jul 21, 2017 at 4:40 PM, dpapad <dpa...@chromium.org> wrote:Reviving this old-ish thread. Node has been added to the toolchain for quite a while now, and is being used to optimize (bundle) Polymer WebUI pages.I recently tried minifying Print Preview code with Uglify (which is not using Polymer). The result was a decrease of browser_resources.pak file from 2.8mb to 2.5mb, which seems non negligible to me, even though I suspect these are pre-gzipping gains.Note (that I assume most people are aware of but mayyybe not): these are desktop-specific (likely Linux) numbers. Also, I'd be weary of size measurements without doing a clobber build (i.e. gn clean <out_dir>) between measuring (not sure if you did or not).
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CANNW_Qqfdq5v_w2%3DLp4qq5H21VNesTNJY%2B3NgzkpVJuPGU1E6A%40mail.gmail.com.
Not sure about uglify, but I know that jscompiler has always optimized for gzipped size, so I'm sure there are gains to be had over plain gzip.
Whatever module system you come up with, I'd ask that you design it such that unused modules are detected and removed on a per-platform basis. E.g., Grit currently has a mode where it generates C++ files that registers URL handlers for all files in a .grd. The result of this is that our unused resources logic considers them all as used when that file is compiled, even if they aren't actually used.