[fpc-devel] TBufferedFileStream

silvioprog silvioprog at gmail.com
Sun Sep 4 02:04:19 CEST 2016


On Sat, Sep 3, 2016 at 8:20 PM, José Mejuto <joshyfun at gmail.com> wrote:

> El 04/09/2016 a las 0:23, silvioprog escribió:
>
>     ----------------------------------------------
>>     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. :-)
>>
>>
> Hello,
>
> Yes, the code is in the test for TBufferedFileStream in the bug ticket
>
> http://bugs.freepascal.org/view.php?id=30549


Great. I'm going to download it.

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
> filesystem.
>
> 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
> is available.
>
> 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

F:=VirtualLayerRoot.CreateStream("/zip1/zip2/myfile.txt",fmOpenRead);


If I understood right, did you create something like GIO or GVFS? Or
neither of them hehe

Another question, does it work remotely too?

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 :)


Lol! :-D

-- 
Silvio Clécio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20160903/7e34e9fa/attachment.html>


More information about the fpc-devel mailing list