Luigi Rizzo said: > On Wed, Aug 03, 2005 at 04:55:33PM +0300, Maxim Sobolev wrote: >> Hi, >> >> I have found the scenario in which our libc behaves utterly >> suboptimally. Consider the following piece of code reads and processes >> every other 512-bytes block in a file (error handling intentionally > > apparently the issue is in fseek(), you should try to track > why fseeko() it goes to the 'dumb:' label where it simply discards the > buffer and does the seek... > ... other stuff omitted ... Looks like the reason it might go into dumb is because he's using SEEK_SET instead of SEEK_CUR and then hitting: if (!havepos && _ftello(fp, &curoff)) goto dumb; havepos only gets set if the SEEK_CUR switch is hit (oddly enough looks like this could be considered a bug since we are relying on the fact that havepos is zero'd when it is allocated, however, I haven't had ample time to say conclusively). Try using SEEK_CUR and skipping your buffer size each time. -- Ryan Sommers ryans_at_gamersimpact.comReceived on Wed Aug 03 2005 - 12:55:20 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:40 UTC