servo icon indicating copy to clipboard operation
servo copied to clipboard

Why are Servo builds 31MB MacOS, 84MB Linux, 102MB Windows?

Open leeoniya opened this issue 8 years ago • 18 comments

Is the large discrepancy due to polyfilling missing or unshimmed platform features via wholesale re-implementations & crate dependencies?

Are Linux and Windows builds ever expected to approach the size of MacOS (presumably the first-class platform)?

Would build size parity be a good meta-bug for any needed shimming work?

thanks!

leeoniya avatar Nov 11 '16 19:11 leeoniya

Linux and macOS ship with a large number of libraries that we depend on. On Windows, we have to ship those libraries with Servo. One example of this is OpenSSL.

We should try and get this down if we can. Certainly things like replacing freetype with DirectWrite will help. OpenSSL can possibly be replaced with SecureChannel, etc.

It would probably be worthwhile to have a metabug if someone was going to go through the libs we need and figure out what needs to be done.

metajack avatar Nov 11 '16 20:11 metajack

A windows OpenSSL binary is a couple megs; probably not worth the effort. Freetype binaries for Windows are ~1MB [1].

That leaves 67MB of "something". It'd be good to see a breakdown of which dependency rabbit holes are heaviest to prioritize efforts.

[1] https://github.com/ubawurinna/freetype-windows-binaries/tree/master/x64

leeoniya avatar Nov 11 '16 22:11 leeoniya

A few things you can do to start the investigation:

  1. Compare rlib sizes for the dependencies. Mostly we statically link everything. If rlibs are bigger on Windows than on other platforms, then maybe this points us to a compiler issue.
  2. Compare all the DLLs we include with the Servo binary.
  3. Check whether the -msvc target produces similarly sized executables. Perhaps this is just the static linking of all the MSYS2 crap into the binary.

metajack avatar Nov 11 '16 23:11 metajack

@metajack thanks for the pointers

leeoniya avatar Nov 11 '16 23:11 leeoniya

The MSVC version are 40MB.

lygstate avatar Nov 14 '16 19:11 lygstate

So this looks like mingw bloat, which will be going away. That puts linux as the long pole now :)

metajack avatar Nov 14 '16 19:11 metajack

are there any working MSVC builds/nightlies to try out or is everything still blocked on https://github.com/servo/servo/issues/12125?

leeoniya avatar Nov 14 '16 22:11 leeoniya

I believe we have fonts working now, so in theory we should switch over to -msvc nightlies I think. @larsbergstrom is there anything blocking us?

metajack avatar Nov 15 '16 00:11 metajack

msvc build are running and show things

lygstate avatar Nov 15 '16 01:11 lygstate

@metajack the only thing blocking us is having buildbot support. I've been focused on Android and have let https://github.com/servo/saltfs/pull/491 rot, unfortunately, but will get back on it once Android is online. Android's a priority because people keep breaking it (it just broke again), so the race of fixing all the submodules and getting buildbot enabled before somebody breaks it again is pretty brutal.

Windows has appveyor on both platforms, and people care more about it :-)

larsbergstrom avatar Nov 15 '16 01:11 larsbergstrom

@larsbergstrom any further progress on this now that https://github.com/servo/saltfs/pull/491 is merged?

leeoniya avatar Jan 08 '17 18:01 leeoniya

@leeoniya No progress, but at this point we should be able to minimize the set of files that are included in the MSVC MSI. Right now, we drag in all the same binaries on both, even though the MSVC version clearly doesn't need all those GNU bits :-)

larsbergstrom avatar Jan 12 '17 19:01 larsbergstrom

On x86_64 archlinux, I got 226MB for release, 544MB debug. Trying to investigate.

potocpav avatar Jan 26 '17 17:01 potocpav

Using https://github.com/google/bloaty on linux:

     VM SIZE                          FILE SIZE
 --------------                    --------------
   0.0%       0 .debug_info         93.5Mi  41.4%
   0.0%       0 .debug_loc          37.7Mi  16.7%
  56.3%  30.7Mi .text               30.7Mi  13.6%
   0.0%       0 .debug_str          12.7Mi   5.6%
   0.0%       0 .debug_ranges       11.6Mi   5.1%
  18.3%  9.96Mi .data               9.96Mi   4.4%
   0.0%       0 .strtab             5.82Mi   2.6%
   0.0%       0 .debug_line         4.93Mi   2.2%
   0.0%       0 .symtab             3.63Mi   1.6%
   5.5%  2.98Mi .rodata             2.98Mi   1.3%
   5.3%  2.89Mi .rela.dyn           2.89Mi   1.3%
   5.2%  2.81Mi .eh_frame           2.81Mi   1.2%
   4.3%  2.35Mi .gcc_except_table   2.35Mi   1.0%
   3.1%  1.71Mi .data.rel.ro        1.71Mi   0.8%
   0.0%       0 .debug_abbrev       1.02Mi   0.5%
   0.9%   479Ki .eh_frame_hdr        479Ki   0.2%
   0.7%   387Ki .data.rel.ro.local   387Ki   0.2%
   0.2%   111Ki [Other]              365Ki   0.2%
   0.0%       0 .debug_aranges       241Ki   0.1%
   0.2%   139Ki .bss                     0   0.0%
   0.0%      15 [None]                   0   0.0%
 100.0%  54.5Mi TOTAL                225Mi 100.0%

Without the debug symbols, the size goes down to 54MiB. Can't compare with Mac/Win since I don't have it :(

potocpav avatar Jan 26 '17 20:01 potocpav

Looking at the current numbers the Windows build is now down to 27 MB. The Linux build has increased slightly to 85 MB however.

atouchet avatar Jun 22 '17 03:06 atouchet

Is there anything to do in this issue? Should it be repurposed in an issue that says we should decrease the binary size in general?

Cc @metajack

nox avatar Oct 07 '17 09:10 nox

Related: https://github.com/servo/servo/issues/18625

paulrouget avatar Oct 07 '17 10:10 paulrouget

New numbers 133 MB on MacOS, 155 MB on Linux, and 133 MB on Windows.

mrobinson avatar May 01 '24 18:05 mrobinson