News for hackers. Stuff that matters.
Re:How is GNU `yes` so fast? by avar on Tuesday June 13, 2017 @05:04AM (#14543640)
One thing to keep in mind when looking at GNU programs is that they're often intentionally written in an odd style to remove all questions of Unix copyright infringement at the time that they were written.

The long-standing advice when writing GNU utilities used to be that if the program you were replacing was optimized for minimizing CPU use, write yours to minimize memory use, or vice-versa. Or in this case, if the program was optimized for simplicity, optimize for throughput.

It would have been very easy for the nascent GNU project to unintentionally produce a line-by-line equivalent of BSD yes.c, which would have potentially landed them in the 80/90s equivalent of the Google v.s. Oracle case.

Re:How is GNU `yes` so fast? by endgame on Tuesday June 13, 2017 @07:20AM (#14544005)
Came here to post this, so instead I'll just back you up with a source:

https://www.gnu.org/prep/standards/standards.html#Reading-No...

Re:How is GNU `yes` so fast? by pge on Tuesday June 13, 2017 @07:49AM (#14544102)
"Add a programming language for extensibility and write part of the program in that language" wow, that's just asking for trouble...
Re:How is GNU `yes` so fast? by jerf on Tuesday June 13, 2017 @09:34AM (#14544578)
Remember that "yes" is the bottom end of complexity here, not the top. As the utility grows larger that stops looking like "asking for trouble" and starts looking like "often the only sensible solution". Expecting people to extend programs in C is often "asking for trouble", after all!

(Lately I've been really tempted to pull a Cato and start terminating my every HN post with "C delenda est." https://en.wikipedia.org/wiki/Carthago_delenda_est)

Re:How is GNU `yes` so fast? by rjbwork on Tuesday June 13, 2017 @11:45AM (#14545655)
Never go full Cato.
Re:How is GNU `yes` so fast? by emodendroket on Tuesday June 13, 2017 @09:17AM (#14544471)
Yeah, I mean, who even uses emacs?
Re:How is GNU `yes` so fast? by colund on Tuesday June 13, 2017 @09:27AM (#14544532)
Youngster!
Re:How is GNU `yes` so fast? by gertef on Tuesday June 13, 2017 @05:43PM (#14548921)
That's the LISP programming philosophy of the creator and host of this web forum
Re:How is GNU `yes` so fast? by k__ on Tuesday June 13, 2017 @09:43AM (#14544632)
Does writing it in a different language suffice?
Re:How is GNU `yes` so fast? by xapata on Tuesday June 13, 2017 @02:19PM (#14547199)
Depends how different.
Re:How is GNU `yes` so fast? by exxo_ on Tuesday June 13, 2017 @05:15AM (#14543671)
Re:How is GNU `yes` so fast? by h2hn on Tuesday June 13, 2017 @08:15AM (#14544198)
Re:How is GNU `yes` so fast? by alkonaut on Tuesday June 13, 2017 @09:49AM (#14544658)
And the motivation: it's used as test inputs. Not sure I agree with completely destroying the readability of a perfectly readable file - but ok.
Re:How is GNU `yes` so fast? by acqq on Tuesday June 13, 2017 @02:58PM (#14547542)
The motivation, as far as I see, was only that it "may be used."

But see the post of belorn where he argues that the error handling seems to be good.

Re:How is GNU `yes` so fast? by Paul-ish on Tuesday June 13, 2017 @01:45PM (#14546835)
Is the date on that accurate, did that happen in 2016? Kinda hurts the theory that they were trying to avoid Unix similarity.
Re:How is GNU `yes` so fast? by jwilk on Tuesday June 13, 2017 @06:13PM (#14549121)
It says: Mar 9, 2015
Re:How is GNU `yes` so fast? by simias on Tuesday June 13, 2017 @09:41AM (#14544619)
One point in favor of this simple version is that it's immediately obvious that it doesn't do the same thing as the OpenBSD version. In OpenBSD `yes a b c` will only print "a" while in GNU it prints "a b c". I did not catch that when I was reading the more complicated modern version.
Re:How is GNU `yes` so fast? by pulse7 on Tuesday June 13, 2017 @05:55AM (#14543775)
(joke) They copied the API of the main() function... :-)
Re:How is GNU `yes` so fast? by jorvi on Tuesday June 13, 2017 @03:17PM (#14547723)
At the risk of sounding like a copyright newbie, shouldn't that be covered by just doing a 'clean room' implementation? As long as you can verifiably prove that you didn't copy the source, it should fall under general use (as there's really only one way of doing such a thing), right? Much like Apple can't patent rectangles, although they tried.
Re:How is GNU `yes` so fast? by nullc on Tuesday June 13, 2017 @06:26PM (#14549192)
Even if you eventually "win" you already lost when plausible litigation began.