On Fri, 8 Jun 2012 09:23:16 -0500 Strake <[email protected]> wrote:
> On 08/06/2012, Ethan Grammatikidis <[email protected]> wrote: > > On the linked page, Johan Petersson wrote: > > > >> It turns out, though, that system calls invoked via interrupts are > >> remarkably slow on the more recent members of the x86 processor > >> family. An int 0x80 system call can be as much as an order of > >> magnitude slower on a 2 GHz Pentium 4 than on an 850 MHz Pentium III. > > > > Will linux-vdso or linux-gate be properly used by a statically linked > > binary? Does it perhaps require /lib/ld-linux.so to link it in? > > > > I ask because I have some reason to believe syscall performance is > > important if you want to work in the unix way, and doubly so if you > > want a suckless system. Petersson here describes an order of magnitude > > difference in syscall performance. I'm not sure of my conclusion but > > it's something to keep an eye on, perhaps timing the piping of data in > > both static and conventional Linux systems on the same hardware. > > On my x86 machine: > > $ cat test.c > #include <sys/types.h> > #include <sys/stat.h> > #include <fcntl.h> > #include <unistd.h> > > int size = 1<<18; > int n = 1<<16; > > void main () { > char x[size]; > int ii; > > int ifd = open ("/dev/zero", O_RDONLY); > int ofd = open ("/dev/null", O_WRONLY); > > for (ii = 0; ii < n; ii++) if (read (ifd, x, size) < 0 || > write (ofd, x, size) < 0) exit (1); > } > $ ls -l $(which cc) > lrwxrwxrwx 1 root root 3 May 7 01:19 /usr/bin/cc -> gcc > $ cc test.c && ldd a.out > linux-vdso.so.1 => (0x00007fffbfbff000) > libc.so.6 => /lib/libc.so.6 (0x00007faf905f7000) > /lib/ld-linux-x86-64.so.2 (0x00007faf90998000) > $ time ./a.out > ./a.out 0.01s user 3.13s system 99% cpu 3.144 total > $ cc -static test.c && ldd a.out > not a dynamic executable > $ time ./a.out > ./a.out 0.00s user 3.14s system 100% cpu 3.145 total > > No worries, it seems. > > Cheers, > strake > Awesome! Thanks for testing -- This is obviously some strange usage of the word "simple" that I was previously unaware of.
