<div dir="ltr">The question "why do we have setlinebuf(stdout)?" came up on the list<br>recently, and by strange coincidence here it is causing more trouble:<br>performance rather than usability this time. Just removing the line<br>buffering alone results in a significant speedup.<br><br>The switch to use %lld rather than %f in obvious cases is another major<br>speedup.<br><br>Calling strlen() once on TT.s and using fwrite() rather than using<br>printf() every time wouldn't be noticeable if the other two issues<br>weren't fixed, but is a decent chunk of the remaining time at this point.<br><br>GNU seq is still *another* 10x faster on my desktop, and I did experiment<br>with inlining the trivial `n /= 10` integer-to-ascii algorithm (to at<br>least remove some of the remaining printf() overhead) but the savings from<br>that were quite small at this point and didn't seem worth the extra<br>code. And while being 100x worse was a human-noticeable thing, being<br>10x worse than "basically instant even on very large inputs" doesn't<br>seem likely to be something anyone will notice (and we can worry about<br>that if/when they do).<br>---<br> main.c         |  1 -<br> tests/seq.test |  2 ++<br> toys/lsb/seq.c | 21 ++++++++++++++++-----<br> 3 files changed, 18 insertions(+), 6 deletions(-)<br></div>