The german help text of ReadData() was missleading.
I read that the whole file is loaded, but the file is loaded from the current file position onwards.
I corrected my code above and tested it.
I also placed a 'bug report' in the documentation section.
But that's a reason why a 'working code' is needed.
I was to lazy to write a test code, so the bug came into the forum.
then it looks like that the flag #PB_File_IgnoreEOL only tells the procedure that it should read
all lines one after an other and concat them, which is slow.
jacky wrote: Sat Mar 26, 2022 2:08 pm
Yeah, it seems that's the way how it works.
If PB would internally use a fast concatenation method that procedure wouldn't fall back in execution time that much...
Hence why I reported it as bug mon5s ago, but it was not considered as such by Fred. This is post number x about finding out by chance how slow the option #PB_File_IgnoreEOL is. Freds argument was: it does not use much memory for larger files. However, in that case it is just utterly too slow because of bad performance of string concatenation. And at the end you still have the whole file text in one variable, so seems like a nonsense argument to me. Fix the lib would be my advise,
Id you read first the file complete in a buffer and use then PeekS(),
you need the buffer memory AND the string memory.
So if you read a 500MB ASCII file, you need 500MB buffer + 1000MB by the string.
If you read only small chunks of 1kb you need 1kB + 1000MB string.
You save nearly 500MB, which can be essential.
If anyone can post here a few small files with those different formats it wood be a good place to examine the existing problems and there solutions. Or is there a good link to such files ?
Thanks
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.
Well, the lack of performance makes it unusable either way when reading a huge file. So the buildin function should be improved. The simple string concatenation it supposedly uses is easy to improve upon. Im fine with less memory usage, but its implementation is severely lacking and makes some programs needlessly slow with the programmer being ignorant cause he thinks using a buildin function to read the whole file would be fastest.