Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Quotations on simplicity in software design (jbox.dk)
1 point by opusdie on Dec 24, 2014 | hide | past | favorite | 1 comment


I saw the first line, "Remember that there is no code faster than no code." and realized it needs at least one qualifier; just because you see no code doesn't mean it isn't there.

  % echo -n "" > nothing.sh
  % cat > nothing.c
  int main() {
    return 0;
  }
  ^D
  % cc nothing.c -o nothing
  % chmod +x ./nothing.sh
  % ls -l nothing.sh nothing
  -rwxr-xr-x  1 dalke  admin  8648 Dec 24 16:55 nothing
  -rwxr-xr-x  1 dalke  admin     0 Dec 24 16:59 nothing.sh

  % time ./nothing.sh
  0.007u 0.006s 0:00.01 0.0%	0+0k 0+0io 0pf+0w
  % time ./nothing.sh
  0.006u 0.005s 0:00.01 0.0%	0+0k 0+0io 0pf+0w
  % time ./nothing.sh
  0.006u 0.005s 0:00.01 0.0%	0+0k 0+0io 0pf+0w

  % time ./nothing
  0.000u 0.000s 0:00.00 0.0%	0+0k 0+0io 0pf+0w
  % time ./nothing
  0.000u 0.000s 0:00.00 0.0%	0+0k 0+0io 0pf+0w
  % time ./nothing
  0.000u 0.000s 0:00.00 0.0%	0+0k 0+0io 0pf+0w
An empty file (which is treated as a shell script) takes longer to run than the 8K file.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: