Sujet : Re: xxd -i vs DIY Was: C23 thoughts and opinions
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.cDate : 30. May 2024, 12:41:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240530144154.000035ab@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Wed, 29 May 2024 01:24:56 +0300
Michael S <
already5chosen@yahoo.com> wrote:
On Tue, 28 May 2024 23:08:22 +0100
bart <bc@freeuk.com> wrote:
On 28/05/2024 21:23, Michael S wrote:
On Tue, 28 May 2024 19:57:38 +0100
bart <bc@freeuk.com> wrote:
OK, I had go with your program. I used a random data file of
exactly 100M bytes.
>
Runtimes varied from 4.1 to 5 seconds depending on compiler. The
fastest time was with gcc -O3.
It sounds like your mass storage device is much slower than aging
SSD on my test machine and ALOT slower than SSD of David Brown.
My machine uses an SSD.
SSDs are not created equal. Especially for writes.
However the tests were run on Windows, so I ran your program again
under WSL; now it took 14 seconds (using both gcc-O3 and gcc-O2).
3 times slower ?!
I never tested it myself, but I heard that there is a significant
difference in file access speed between WSL's own file system and
mounted Windows directories. The difference under WSL is not as big
as under WSL2 where they say that access of mounted Windows filesystem
is very slow, but still significant.
I don't know if it applies to all file sizes or only to accessing many
small files.
I tested it under WSL (not WSL2 !).
Host: Windows Server 2019
Guest: Debian boolworm.
uname -r
4.4.0-17763-Microsoft
I see now slowness at all. In fact getc/fgetc are the same speed and 3
times faster than on Windows with MSVC compiler on the same computer.
fread test is ~30% faster.
Full bin_to_list (latest variant) is 10-25% faster than Windows, but
both are very fast and results are not very stable so precise comparison
is hard.
Access to mounted Windows files via /mnt/d/... is very fast - read
speed is approximately the same as "guest's native" ext4-in-container;
write speed is up to 20% faster than ext4.
All that, of course, bulk read and write speed on huge files. It is
possible that for small files the table is turned.
For the record: On WSL 'xxd -i' took 13.6 seconds to process 151 MB
input file (7z archive) and produce 992 MB output text (both input and
output on /mnt/d). That's much faster than 39 seconds under msys2 on the
same computer, but ~10 times slower than my latest variant.