Faster FileStream experiments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
43 messages Options
123
Reply | Threaded
Open this post in threaded view
|

HANDLE versus stdio (was: Faster FileStream experiments)

David T. Lewis
On Fri, Nov 27, 2009 at 11:24:37PM +0100, Nicolas Cellier wrote:
>
> I wonder why level 3 stdio was used (FILE * fopen, fclose ...) rather
> than level 2 (int fid, open, close, ...) in file plugin... Better
> portability ?
>
> Nicolas

This is an interesting question, and I wonder if anyone has ever measured
the difference between the two approaches.

In the Windows VM, FilePlugin uses the standard win32 interface interacting
with HANDLE rather than (FILE *). The other VMs use stdio in the file
plugin. Loosely speaking, the Windows VM is using "level 2", while the
other VMs are working at "level 3".

Has anyone ever measured the file IO performance of an image running
on the Windows VM versus a Unix or Mac VM on the same hardware? The
plugin could be written in either manner on any of the platforms, so
it would be interesting to know if one approach delivers better overall
results than the other.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: HANDLE versus stdio (was: Faster FileStream experiments)

Igor Stasenko
2009/12/3 David T. Lewis <[hidden email]>:

> On Fri, Nov 27, 2009 at 11:24:37PM +0100, Nicolas Cellier wrote:
>>
>> I wonder why level 3 stdio was used (FILE * fopen, fclose ...) rather
>> than level 2 (int fid, open, close, ...) in file plugin... Better
>> portability ?
>>
>> Nicolas
>
> This is an interesting question, and I wonder if anyone has ever measured
> the difference between the two approaches.
>
> In the Windows VM, FilePlugin uses the standard win32 interface interacting
> with HANDLE rather than (FILE *). The other VMs use stdio in the file
> plugin. Loosely speaking, the Windows VM is using "level 2", while the
> other VMs are working at "level 3".
>
> Has anyone ever measured the file IO performance of an image running
> on the Windows VM versus a Unix or Mac VM on the same hardware? The
> plugin could be written in either manner on any of the platforms, so
> it would be interesting to know if one approach delivers better overall
> results than the other.
>

Well, its quite nontrivial task to compare IO performance between
platforms, because there many other things involved.
One could run faster than other, but you can't tell exactly it is
because of use of different IO functions in primitives, because it
could be because of different reasons, like memory management, the way
how OS scheduling CPU etc.

> Dave
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

Re: HANDLE versus stdio (was: Faster FileStream experiments)

Colin Putney
In reply to this post by David T. Lewis

On 3-Dec-09, at 10:12 AM, David T. Lewis wrote:

> In the Windows VM, FilePlugin uses the standard win32 interface  
> interacting
> with HANDLE rather than (FILE *). The other VMs use stdio in the file
> plugin. Loosely speaking, the Windows VM is using "level 2", while the
> other VMs are working at "level 3".

Performance is certainly interesting, but to me it's mostly a question  
design. FILE * is a high-level API, meant for C programmers to use  
directly. A lot of what it provides is already implemented in the  
image-level code.

For example, a FileStream has a position instance variable, but the  
FilePlugin primitives also maintain a position, and we have to choose  
between keeping them in sync or ignoring the image-level position.  
Both of those are problematic. I'd like to see file IO primitives that  
are implemented in terms of pread() and pwrite() or the like.

  I like to primtives to be as primitive as possible. :-)

Colin

123