lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Feb 21, 2014, at 22:26 , Sean Conner wrote:
...
3) Switch to using fgetc() in a loop.  This too, degrades performance if
only because fgets() can use implementation details it is privy to to
increase performance, but it is still using standard C calls.  Francisco
Olarte proposed this fix.  And if a fix is to be used, this is the one I
would actually prefer (it's cleaner than #2, the performance degredation is
constant (not based on buffer size), portable, and provides consistent
behavior across C implementations).
...
Of the four that I see, #1 or #3 are the best solutions in my mind.  All
(except #1) degrade performance somewhat, but I would prefer a correct
solution [2] over a fast solution.

 -spc (Surprisingly, I'm not against #3 … )

I initially (my second?) email stated that the loop would be ok with me
and only worked on optimizing the performance after Roberto's bible
test case.

Given the lack of trust in C libraries by most commenters this getc()
loop would still be a favorable fix for me, too.

-- 
 ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin
 http://exactcode.com | http://exactscan.com | http://ocrkit.com | http://t2-project.org | http://rene.rebe.de