[Toybox] Android commit 0a281c2d6585

Rob Landley rob at landley.net
Tue May 28 02:04:03 PDT 2019


You yanked a shared library dependency to save a milisecond of startup time, so
I thought I'd point at:

  https://landley.net/notes-2009.html#14-10-2009

I.E. many moons ago I worked out I got a 20% speedup running shell scripts under
qemu when I statically linked busybox. That said, QEMU is a pathological case
for that because self-modifying code causes it to retranslate the code page, so
I dunno how much of a speedup you'd see, but if you're chasing milliseconds it's
probably worth a look?

  $ file prebuilts/build-tools/linux-x86/bin/toybox
  prebuilts/build-tools/linux-x86/bin/toybox: ELF 64-bit LSB shared object,
  x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-
  x86-64.so.2, for GNU/Linux 2.6.24, stripped

It also means it could be statically linked against bionic instead of glibc...

Rob

P.S. up until 2006 or so the dynamic linker used to patch each function call and
global variable access in situ, which dirtied a whole lot more physical pages.
Then we started having proper GOT and PLT arrays everything bounced off, which
was an extra layer of indirection but meant the modified stuff was collated. I
dunno how much of this was x86 being register starved and how much was a
decision based on prefetch and speculative execution in processor pipelines and
so on (now with spectre and meltdown and zombieload and...) I _think_ this was
after that, but optimization advice goes bad faster than milk, I'm just asking
if you've tried benchmarking this as long as you're fiddling in that area anyway...



More information about the Toybox mailing list