|
Hi, On Feb 22, 2014, at 19:16 , Francisco Olarte wrote:
Yeah, fugly, … just trying to make the best out of the C function while trying to preserve the performance. While I do not really like to beat this dead horse even further, … I still find this "undefined" behavior not really elegant and matching to Lua's otherwise quite high standards of elegance and cleanness. Although by now Roberto is probably already shivering with each email with this subject in his inbox, one more proposal to fix this in a clean way could be: your gets loop but not using the buffer management advance function in "luaL_addchar(buffer, c);", but call fgetc in a tight loop with the existing buffer resizing with LUAL_BUFFERSIZE. That could potentially be much faster. However, as most people are against any improvement here I did not yet benchmark that, … yet. I do not really see why others have such reservations against improving Lua to better handle this kind of binary files. Seriously, separating a stream at '\n' is not that difficult, nor should it be that 'verboten'. -- ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin http://exactcode.com | http://exactscan.com | http://ocrkit.com | http://t2-project.org | http://rene.rebe.de |