Skip to content

Oversized executables #747

@alexchandel

Description

@alexchandel

The uutils executables are a bit larger than their native counterparts. These are the stats on OS X with O3, LTO, and alloc_system:

Name Native uutils
base64 8.0K 200K
basename 8.0K 160K
cat 8.0K 204K
chmod 12K 524K
chroot 8.0K 220K
cksum 8.0K 180K
comm 8.0K 168K
cp 12K 204K
cut 8.0K 296K
dirname 8.0K 152K
du 12K 328K
echo 8.0K 132K
env 8.0K 148K
expand 8.0K 208K
expr 8.0K 168K
factor - 208K
false 4.0K 80K
fold 8.0K 196K
groups 8.0K 168K
hashsum - 596K
head 8.0K 196K
hostid - 148K
hostname 8.0K 192K
id 8.0K 192K
kill 8.0K 180K
link 8.0K 156K
ln 8.0K 208K
logname 8.0K 156K
mkdir 8.0K 192K
mkfifo 8.0K 164K
mv 8.0K 220K
nice 8.0K 176K
nl 8.0K 512K
nohup 8.0K 184K
nproc - 160K
od 16K 140K
paste 8.0K 200K
printenv 8.0K 160K
ptx - 668K
pwd 8.0K 164K
readlink 12K 192K
realpath - 192K
relpath - 200K
rm 8.0K 208K
rmdir 8.0K 176K
seq 8.0K 228K
shuf - 224K
sleep 8.0K 200K
sort 28K 220K
split 8.0K 228K
stdbuf - 244K
sum 8.0K 180K
sync 8.0K 148K
tac - 192K
tail 12K 200K
tee 8.0K 204K
test 8.0K 112K
timeout - 264K
touch 8.0K 200K
tr 12K 196K
true 4.0K 80K
truncate - 196K
tsort 8.0K 216K
tty 8.0K 160K
uname 8.0K 164K
unexpand 8.0K 212K
uniq 8.0K 220K
unlink 8.0K 164K
uptime 12K 204K
users 8.0K 160K
wc 8.0K 192K
whoami 8.0K 160K
yes 4.0K 160K

I think the funniest one is nl, which is 6300% larger than the native nl. jemalloc would've added another 230K to each of these.

I realize some of this is Rust's fault: when an optimized, LTO'd, alloc_system'd fn main(){println!("Hi!\n");} is still 84K, there's not much room. For example from the object dump/disassembly, about 9% of that dead weight was panicking code & string literals for the standard library :\ If we're really condemned to that, and to an 80K hello world, with all the implied overhead (and it's clearly to scale, as seen above), then this raises serious doubts about Rust as a system language.

But surely we can shed some of the remaining 196K/216K/etc off of tr/tsort/friends? The median size of the native executables is 8.0K.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions