I appreciate all suggestions and opinions mentioned. But let me
clarify why I made those design choses a bit more.

- Yes, it is faster because OpenSSL uses specific assembly
instructions of modern CPUs.

- I believe that this optimization should *not* be done in APR
(apr-util to be more specific). Most of its users don't want it to be
crazy fast. They would most probably choose a more portable, simple,
and lightweight implementation instead. Subversion, on the other hand,
will generally work faster as checksumming improves.

- There is a public structure for checksum context data in APR so this
might be problematic to adapt a different implementation.

- Httpd barely uses it and it's never critical to the overall
performance part. I could find that only mod_lua and password
authentication support uses SHA1 from APR. It's not an optimization
whenever this code is called once a decade for like <20 bytes of data.

- I discovered a much more convenient cryptography library (AWS-LC
[1]). It's basically a fork of OpenSSL, but with simplified
everything. We might make an interface for it as well.

- It's a great idea to "steal" optimized hash implementation, so we'd
get that performance boost without requiring any third-party
libraries. I think AWS-LC would be more suitable for this purpose
because it bundles pre-generated assembly sources whereas OpenSSL
needs perl for that.

Therefore, I suggest we move towards optimizing hashes in Subversion
specifically. I don't like OpenSSL either, but it's a good enough
direction to start.

[1]  https://github.com/aws/aws-lc

-- 
Timofei Zhakov

Reply via email to