Post by JosÃ© Mejuto
CACHE 1000000 byte sequential reads in 46 ms.
FILE 1000000 byte sequential reads in 2200 ms.
Did you get this result from some sample? If so, could you share it?! I
would be glad to test it checking the TBufferedFileStream performance. :-)
Yes, the code is in the test for TBufferedFileStream in the bug ticket
Delphi TBufferedFileStream should be faster as I think it implementes a
dumb buffer, or just better a read ahead buffer, so it works better for
sequential read and worst for butterfly reads on same zones.
For my works I just use my class TCacheStream which applies the same
cache code but over any stream already created. I need this as a stream
filter because I'm working on virtual file systems which access a stream
(whichever class) as a blocks device stream, so I can in example work
with ZIP files as they was a disk with functions to browse the ZIP
entries, create files, delete, read and write, once each "file" is
closed and the stream that holds the whole file is freed in destroy it
updates the zip according, compressing new and modified streams and
copying/moving the blocks not touched.
Part of this code is in the Excel reader/writer in fpspreadsheet package.
Most of this classes are mostly beta versions, operative in my
environment but not valid for wide use, that's the reason I had not
published them (and the lack of comments, and code convolution).
Currently I have, more or less:
Native filesystem: Read/Write. Maps the native filesystem to my virtual
ZIP filesystem: Read/Write. Up to 2GB zip files.
FAT16: Read. Typical dd images.
FAT32: Read. Typical dd images.
Microsoft Binary Compound: Read/Write with limitations. Used in XLS, DOC,...
Sample filesystem: Read/Write. Very limited sample filesystem.
MBR Partition: Read. Used to access dd images when partition information
RAR: Browse only. With special crafted dll for windows also decompress,
but it is a dirty hack.
ISO: Read only. Limited and based in GPL code.
The virtual file system allows to mount an filesystem (above) in a
folder for browsing, open, and so on, so in example you open a ZIP and
inside you find another zip, you can mount the inner stream in a folder
and access to inner files transparently to your code, with a path like
I can publish the code but I can not provide any guarantee of correct
work and that it will not delete all your hard disk :)
fpc-devel maillist - email@example.com