[fpc-pascal] File handling: the TFileStream or the classical way is faster and more efficient?

Jürgen Hestermann juergen.hestermann at gmx.de
Wed May 27 17:45:28 CEST 2015

Am 2015-05-27 um 09:38 schrieb Michael Schnell:
> On 05/26/2015 06:25 PM, Jürgen Hestermann wrote:
>> If you copy thousands of files with only a few bytes each
>> then it may become very noticable, what "else" is done
>> (in additon to the pure OS copy of the files).
> I don't think so. Opening the file is a tedious task for the OS. So I suppose the User-program/OS relation is not that different regarding the file size.
I have written a file manager that logs whole disks.
When I do this twice (so that all data is already in cache on the second run)
I can log (read the meta data like name, size, date, etc.) about 50,000 files
in one second on the second run (doing this on an SSD maybe nearly as fast
on the first run already, I have never tested it).
That means it only takes 20 nanoseconds per file to read and store the meta data
which does not sound much overhead to me.

When it now comes to reading the contents of these files this may take much longer dependent on their size.

More information about the fpc-pascal mailing list