[EXTERNAL] - Re: Build Options for maximum performance of SHA256
Michael Wojcik
mwojcik at opentext.com
Sat Feb 10 21:14:21 UTC 2024
> From: openssl-users <openssl-users-bounces at openssl.org> On Behalf Of
> opensslmailing via openssl-users
> Sent: Saturday, 10 February, 2024 13:12
>
> - the file is 4 GiByte of size
> - I'm reading the file using OpenSSL BIO mechanism with the "rb"
> option, so read as binary
That is going to be slow. How slow depends on a number of factors, but using stdio for something of that size is definitely sub-optimal.
It would be much better to map it into memory. If your application is 64-bit, you might be able to map the whole thing, though how well Windows and your particular system will cope with that I couldn't say. If your application is 32-bit, then obviously you can't, since your entire address space is only 4GiB (and Windows doesn't let you use all of that). So process it in chunks; even in 32-bit you can probably map 1GiB at a time, I think.
See the CreateFileMapping and MapViewOfFile APIs.
> - I don't know how the other program (btw. it is fchash from the
> FastCopy program) reads the file
Just from the name, I'd guess it uses memory-mapped I/O.
--
Michael Wojcik
More information about the openssl-users
mailing list