Hi all,
I wrote a script to compare the full size of different feature combinations for SWI-Prolog. By full size I mean the stored size of the SWI-Prolog binary, library and its runtime files, along with all dependencies needed to support that particular feature set.
It’s not a very clever script. I just run a lot of different nix builds of the swipl-devel master branch, then ask nix about the total dependency closure size. You can find it in the swipl-nix repository (sizes.nix), and run it with nix run github:matko/swipl-nix#sizes
, though I don’t recommend doing so unless you’re prepared to simultaneously build and store 12 different versions of SWI-Prolog.
I am now running this against an experimental branch where I’m additionally working on cutting down the gperftools
dependency to just the tcmalloc
library (*). You should be able to get something close to what I got by explicitely referring to the swipl-nix commit I used (929c70e, corresponding to e54300d in swipl-devel). This is on x86_64-linux.
> nix run github:matko/swipl-nix/929c70e#sizes
PKG SIZE MBSIZE CHANGE
minimal 85150856 81.20M
withYaml 85345360 81.39M +.18M
withOdbc 86437168 82.43M +1.22M
withPcre 87183920 83.14M +1.93M
withDb 89610072 85.45M +4.25M
withGui 112569312 107.35M +26.14M
withPython 204178024 194.71M +113.51M
withJava 1027237752 979.65M +898.44M
noJava 239292448 228.20M -880.67M
noPython 1045644416 997.20M -111.67M
noGui 1150413224 1097.11M -11.76M
full 1162748240 1108.88M
In this overview, minimal
and full
are versions of SWI-Prolog with all 7 measured features (yaml, odbc, pcre, db, gui, python, java) disabled/enabled. The various withX
rows are minimal
, plus only that one feature enabled. The various noX
rows are full, minus that one feature disabled.
The reason for providing both a ‘withX’ and ‘noX’ for some packages is that there’s dependency reuse between features. The noX
is therefore smaller than the corresponding withX
.
What stands out to me is how insignificant the GUI support is compared to what java and python are pulling in. Currently the common approach distros take is to provide SWI-Prolog in a version with and without GUI. Shouldn’t there be some consideration about these other two dependencies?
I understand that the java feature doesn’t actually reach beyond the single jar file that gets generated, which a packaging system could put in its own package, eliminating the dependency for those that don’t need it without needing a custom build.
I’m less sure about the python support, but isn’t it contained to its own library, which could potentially be installed separately?
(*) Currently on swipl-nix master another 63MB of dependencies is pulled in, due to tcmalloc
(which itself is just 215 kilobytes) being packaged along with all of gperftools
. This is solvable, but will probably take some collaboration.