lantern-ui is too big
One of the main goals of the Valencia release is to achieve a small binary, perhaps even small enough to distribute via email. In its current form, lantern-ui increases the size of the gzip compressed lantern binary by about 6MB. That seems like way too much.
@atavism is working on trimming it down, but I wonder what the minimum size is that we can actually achieve given our web-based UI and fancy graphics. Let's keep an eye on this and assess once @atavism has trimmed what fat he can.
Wo - that's a way bigger increase than last time I played with it. Agreed that's way too big.
On Tuesday, February 10, 2015, oxtoacart [email protected] wrote:
One of the main goals of the Valencia release is to achieve a small binary, perhaps even small enough to distribute via email. In its current form, lantern-ui increases the size of the gzip compressed lantern binary by about 6MB. That seems like way too much.
@atavism https://github.com/atavism is working on trimming it down, but I wonder what the minimum size is that we can actually achieve given our web-based UI and fancy graphics. Let's keep an eye on this and assess once @atavism https://github.com/atavism has trimmed what fat he can.
— Reply to this email directly or view it on GitHub https://github.com/getlantern/lantern/issues/2240.
President Brave New Software Project, Inc. https://www.getlantern.org pgp A998 2B6E EF1C 373E 723F A813 045D A255 901A FD89
du -k | sort -nk 1 under app/bower_components
556 ./jquery/src
724 ./ui-bootstrap/src
904 ./ui-bootstrap/misc/test-lib
1024 ./jquery
1188 ./ui-bootstrap/misc
1264 ./angular-scenario
1460 ./angular
2140 ./ui-bootstrap
9040 .
I think at least ui-bootstrap, angular-scenario and jquery/src can be removed.
Better approach is to use jsmin and htmlmin to compress assets to dist folder, and only embed that folder. I've done that before with similar libraries, reduced js size to < 500KB.
Yup makes sense @fffw
On Thursday, February 12, 2015, fffw [email protected] wrote:
du -k | sort -nk 1 under app/bower_components
556 ./jquery/src 724 ./ui-bootstrap/src 904 ./ui-bootstrap/misc/test-lib 1024 ./jquery 1188 ./ui-bootstrap/misc 1264 ./angular-scenario 1460 ./angular 2140 ./ui-bootstrap 9040 .
I think at least ui-bootstrap, angular-scenario and jquery/src can be removed.
Better approach is to use jsmin and htmlmin to compress assets to dist folder, and only embed that folder. I've done that before with similar libraries, reduced js size to < 500KB.
— Reply to this email directly or view it on GitHub https://github.com/getlantern/lantern/issues/2240#issuecomment-74096407.
President Brave New Software Project, Inc. https://www.getlantern.org pgp A998 2B6E EF1C 373E 723F A813 045D A255 901A FD89
As a point of comparison, installers built from 1.5.17 with and without lantern-ui differ in size as follows:
with lantern-ui: 15.9 MB
without lantern-ui: 13.8 MB
So the ui takes up 2.1 MB.
So also @atavism, @fffw, and @oxtoacart, remember the only directory we actually distribute is lantern-ui/app/
And just at a quick glance the code in lantern-ui/app at least on devel is almost the exact same size as on master, so not sure if the issue is in the compression, in how we're embedding it, in what we're including, or what, but something seems off in one of the above.
Employed Gulp tools to build the whole tree from 'app' to 'dist', reduced size to half and didn't impact the function.
Maybe we can consolidate fonts if we want it to be smaller.
596 ./data
1024 ./bower_components/jquery
1416 ./locale
1460 ./bower_components/angular
2408 ./font
5636 ./bower_components
10852 .
~/workspace/go/src/github.com/getlantern/lantern-ui/app (issue-2195-fffw) $ cd ../dist/
~/workspace/go/src/github.com/getlantern/lantern-ui/dist (issue-2195-fffw) $ du -k | sort -nk 1
32 ./partials
148 ./style
216 ./img
596 ./data
660 ./js
1416 ./locale
2408 ./font
5480 .
I need write permission on https://github.com/getlantern/lantern-ui to push my branch.
@fffw Awesome! I just added you.
If we get things down to 2.1 MB compressed (as embedded in the executable), that's good enough for now.
@myleshorton @atavism @carsonefv
In the new reduced set of web resources, the single largest remaining category of files is now our fonts.
Do you happen to know if we're actually using all of those fonts in the Lantern UI?
Wow great find @oxtoacart! That's crazy. I say we just switch to standard fonts wherever we can. @carsonefv can you maybe take a look at what standard web fonts are the closest to each of those fonts we're using? If I remember correctly, @skivvies added them I think for getting some of the left-to-right stuff working, but over 1MB for fonts is not what we want.
Actually, given that this could cause issues with right-to-left stuff, maybe we ticket it for now and dive in post-Valencia? What do you think @oxtoacart?
Yeah, ticketing for now is fine. An intermediate step rather than removing these fonts completely would just be to confirm that we're actually using all of them. If there are a few that are unused, that would be a quick win. For example, there's an svg file in there - is that even in use or is that just for reference?
@myleshorton You had expressed some concern about resources potentially ballooning when embedded in our binary. I ran an experiment using the latest tarfs.
The dist folder, compressed with gzip, is 2198526 bytes. When embedded in the binary, after gzip compression, it adds 2199457 bytes to the size of the binary, which is 931 bytes extra, or 0.04%.
So, I think we're good there.
Sure, where can I see what fonts we're currently using? I think we should just use the helvetica font family, that's what I used for the welcome screen design and it looks very similar to the current UI.
-Carson
On Wed, Feb 18, 2015 at 11:58 AM, oxtoacart [email protected] wrote:
@myleshorton https://github.com/myleshorton You had expressed some concern about resources potentially ballooning when embedded in our binary. I ran an experiment using the latest tarfs.
The dist folder, compressed with gzip, is 2198526 bytes. When embedded in the binary, after gzip compression, it adds 2199457 bytes to the size of the binary, which is 931 bytes extra, or 0.04%.
So, I think we're good there.
— Reply to this email directly or view it on GitHub https://github.com/getlantern/lantern/issues/2240#issuecomment-74901335.
I just ran a grep to see which of the files is referenced in our css or javascript:
➜ font git:(issue-2195) ✗ for f in *; do echo "--- $f ---" && grep -Rl $f ../; done
--- DroidSansMono.ttf ---
..//style/app.css
--- LigatureSymbols-2.11.eot ---
..//style/app.css
--- LigatureSymbols-2.11.otf ---
--- LigatureSymbols-2.11.svg ---
..//style/app.css
--- LigatureSymbols-2.11.ttf ---
..//style/app.css
--- LigatureSymbols-2.11.woff ---
..//style/app.css
--- Roboto-Black.ttf ---
..//style/app.css
--- Roboto-BlackItalic.ttf ---
..//style/app.css
--- Roboto-Bold.ttf ---
..//style/app.css
--- Roboto-BoldItalic.ttf ---
..//style/app.css
--- Roboto-Italic.ttf ---
..//style/app.css
--- Roboto-Light.ttf ---
..//style/app.css
--- Roboto-LightItalic.ttf ---
..//style/app.css
--- Roboto-Medium.ttf ---
..//style/app.css
--- Roboto-MediumItalic.ttf ---
..//style/app.css
--- Roboto-Regular.ttf ---
..//style/app.css
--- Roboto-Thin.ttf ---
..//style/app.css
--- Roboto-ThinItalic.ttf ---
..//style/app.css
--- fontawesome-webfont.ttf ---
..//style/app.css
--- fontawesome-webfont.woff ---
..//style/app.css
Looks like we can at least get rid of LigatureSymbols-2.11.otf.
@carsonefv If you're familiar with css, you can see our CSS here:
https://github.com/getlantern/lantern-ui/blob/issue-2195/app/_css/app.css
From a quick glance at the css, it looks like all of the fonts are used by at least one CSS directive, so I don't think we can take anything except LigatureSymbols-2.11.otf out right now.
I've opened #2244 for the font issue.
Ok I see - I would suggest the following changes:
Droid Sans Mono change to Andale Mono Roboto Thin change to Helvetica Light Roboto Light change to Helvetica Roboto change to Helvetica Bold Roboto Medium change to Helvetica Bold Roboto Black change to Helvetica Bold Ligature symbols - Delete?
On Wed, Feb 18, 2015 at 12:06 PM, oxtoacart [email protected] wrote:
@carsonefv https://github.com/carsonefv If you're familiar with css, you can see our CSS here:
https://github.com/getlantern/lantern-ui/blob/issue-2195/app/_css/app.css
— Reply to this email directly or view it on GitHub https://github.com/getlantern/lantern/issues/2240#issuecomment-74902982.
Thanks @carsonefv! I've noted your suggestion in the new ticket.