Live data from Hacker News

Code Inflation [pdf]

computer.org

21–30 of 30 posts

Re: Code Inflation [pdf]

#21
post #17

So, I found this very interesting to read. I created an empty file, a la the original true, named truth and placed it at the beginning of my $PATH. $ time truth real 0m0.002s user 0m0.000s sys 0m0.003s I then realized that since true is a builtin, I'd need to call the true binary with its full path. I'd hate to give one an unfair advantage by having to search the path vs being called by name. So.... $ time /usr/bin/t…

I just repeated your test, but got opposite results: $ time /usr/bin/true real 0m0.003s user 0m0.001s sys 0m0.002s $ time /usr/bin/truth real 0m0.001s user 0m0.000s sys 0m0.001s I can't imagine for the life of me how an empty file could perform worse than an actual binary, but there's gotta be a reason.

If you're relying on an empty binary, or exit 0; instead of an actual binary you have to execute a shell process to evaluate it. The binary doesn't need to load a shell, it can just do a bit of setup, then make a single exit 0 system call.

Re: Code Inflation [pdf]

#23

Here's a link to the coreutils source for true if anyone's interested: http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/true... I think the argument can be made that command lines tools shouldn't provide versioning and help text at all - leave it up to the manual pages.

Also worth looking at is false.c, which is considerably shorter: http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/fals...

Re: Code Inflation [pdf]

#26

Those who don't see anything unusual or wasteful about an 8KB+ executable whose only action is to exit and return a value are recommended to watch this demo generated in realtime by a 4KB executable: http://www.youtube.com/watch?v=jB0vBmiTr6o There's more here: http://www.pouet.net/prodlist.php?type[]=4k The demoscene is basically the exact opposite of mainstream software culture, and although it's focused on multime…

Here's an awesome one I found http://koti.kapsi.fi/rimina/living_in_a_box_720p.html Sad buildings

Re: Code Inflation [pdf]

#27
ironically, this article looks like it grew organicaly from the 14 words

   "Software tends to grow over time, whether or not there’s a need for it"
that it highlights, until it contained an introduction, a First Law, a table of data abou the Unix "true" command, the same data as a figure, a logarithmic chart of bash, and a foray into "dark code" (which can be present at any size.)

Re: Code Inflation [pdf]

#28
post #17

So, I found this very interesting to read. I created an empty file, a la the original true, named truth and placed it at the beginning of my $PATH. $ time truth real 0m0.002s user 0m0.000s sys 0m0.003s I then realized that since true is a builtin, I'd need to call the true binary with its full path. I'd hate to give one an unfair advantage by having to search the path vs being called by name. So.... $ time /usr/bin/t…

I just repeated your test, but got opposite results: $ time /usr/bin/true real 0m0.003s user 0m0.001s sys 0m0.002s $ time /usr/bin/truth real 0m0.001s user 0m0.000s sys 0m0.001s I can't imagine for the life of me how an empty file could perform worse than an actual binary, but there's gotta be a reason.

this is what happens when we aren't allowed to use p values anymore :)

https://www.sciencebasedmedicine.org/psychology-journal-bans...

The default p is p = 0.5, so I have no trouble accepting both your conclusion and your parent's :)

seriously though, this is why we use significance testing in real fields, like computer science...

Re: Code Inflation [pdf]

#29

Earlier quoted context omitted.

I just repeated your test, but got opposite results: $ time /usr/bin/true real 0m0.003s user 0m0.001s sys 0m0.002s $ time /usr/bin/truth real 0m0.001s user 0m0.000s sys 0m0.001s I can't imagine for the life of me how an empty file could perform worse than an actual binary, but there's gotta be a reason.

If you're relying on an empty binary, or exit 0; instead of an actual binary you have to execute a shell process to evaluate it. The binary doesn't need to load a shell, it can just do a bit of setup, then make a single exit 0 system call.

Thank you. That makes sense. So basically the empty file is seen by the shell as a "script" that has to be evaluated, so a separate shell process is spun up to handle it? And the difference between my output and the parent's has to do with some difference in our environments?

Re: Code Inflation [pdf]

#30

Earlier quoted context omitted.

I just repeated your test, but got opposite results: $ time /usr/bin/true real 0m0.003s user 0m0.001s sys 0m0.002s $ time /usr/bin/truth real 0m0.001s user 0m0.000s sys 0m0.001s I can't imagine for the life of me how an empty file could perform worse than an actual binary, but there's gotta be a reason.

this is what happens when we aren't allowed to use p values anymore :) https://www.sciencebasedmedicine.org/psychology-journal-bans... The default p is p = 0.5, so I have no trouble accepting both your conclusion and your parent's :) seriously though, this is why we use significance testing in real fields, like computer science...

Exactly. I did the most naive thing possible and only once for each version of true/truth. I was just bored/curious.
Post reply on HN