public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Martin Wege <martin.l.wege@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Cygwin&Win32 file prefetch, block sizes?
Date: Wed, 3 Apr 2024 00:35:27 +0200	[thread overview]
Message-ID: <CANH4o6P8cts9TJgpdjR4mi+sj2YvuDa=d49XLcEVvYnRB81KRw@mail.gmail.com> (raw)
In-Reply-To: <ZgwFNde2z804koS_@calimero.vinschen.de>

On Tue, Apr 2, 2024 at 3:17 PM Corinna Vinschen via Cygwin
<cygwin@cygwin.com> wrote:
>
> On Apr  2 02:04, Martin Wege via Cygwin wrote:
> > Hello,
> >
> > Is there any document which describes how Cygwin and Win32 file
> > prefetch and readahead work, and which sizes are used (e.g. always
> > read one full page even if only 16 bytes are requested?)?
>
> I'm not aware of any docs, but again, keep in mind that Cygwin is a
> usersapce DLL. We basically do what Windows does for low-level file
> access.
>
> > Quick /usr/bin/stat /etc/profile returns "IO Block: 65536". Does that
> > mean the file's block size is really 64k? Is this info per filesystem,
> > or hardcoded in Cygwin?
>
> Hardcoded in Cygwin since 2017, based on a discussion in terms of
> file access performance, especially when using stdio.h functions:
>
>   https://cygwin.com/cgit/newlib-cygwin/commit/?id=7bef7db5ccd9c

OUCH.

While I can understand the motivation, FAT32 on multi-GB-devices
having 64k block size, and Win32 API on Win95/98/ME/Win7 being
optimized to that insane block size, it is absolutely WRONG with
today's NTFS and even more so with ReFS. This only works if you stream
files, but as soon as you are doing random read/writes the performance
is terrible due to cache thrashing. That could explain the many
complaints about Cygwin's IO performance.

So, what can be done? I'm not a benchmarking guru, so I'd like to
propose to add a tunable called EXPERIMENTAL_PREFERRED_IO_BLKSIZE to
the CYGWIN env variable (marked as "experimental"), so the
benchmarking guys can do performance testing without recompiling
everything, get perf results for Cygwin 3.6, and decide what to do for
Cygwin 3.7.

Thanks,
Martin

  reply	other threads:[~2024-04-02 22:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  0:04 Martin Wege
2024-04-02 13:16 ` Corinna Vinschen
2024-04-02 22:35   ` Martin Wege [this message]
2024-04-03  1:10     ` Mark Geisert
2024-04-03  6:44       ` Cedric Blancher
2024-04-04 18:10         ` Brian Inglis
2024-04-03  5:21     ` Cedric Blancher
2024-04-03  8:14     ` Corinna Vinschen
2024-04-03 11:44       ` Corinna Vinschen
2024-04-03 17:42       ` Cedric Blancher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANH4o6P8cts9TJgpdjR4mi+sj2YvuDa=d49XLcEVvYnRB81KRw@mail.gmail.com' \
    --to=martin.l.wege@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).