On Wed, 10 Feb 2021 14:08:22 GMT, PROgrm_JARvis 
<github.com+7693005+jarviscr...@openjdk.org> wrote:

>>> Hi Claes,
>>> Would flattening the state of MD5 bring any further improvements?
>>> [plevart@92bf48f](https://github.com/plevart/jdk/commit/92bf48ff58f0ce9648e49466dbf1befebbf49083)
>> 
>> I think it might, marginally, but it seemed to me that the implCompress0 MD5 
>> intrinsic is using `state` so I've not tried that yet since rewriting and 
>> checking the intrinsic code is a lot of work. (I've blogged about my 
>> experiments in this area and mentioned this issue in passing: 
>> https://cl4es.github.io/2021/01/04/Investigating-MD5-Overheads.html#accidental-constraints)
>
>> 
>> 
>> @JarvisCraft This pull request has been inactive for more than 4 weeks and 
>> will be automatically closed if another 4 weeks passes without any activity. 
>> To avoid this, simply add a new comment to the pull request. Feel free to 
>> ask for assistance if you need help with progressing this pull request 
>> towards integration!

FWIW, I ended up doing two related improvements:

- #1855 - which reduced overheads of constructing MD5, SHA1, SHA2, SHA5 
`MessageDigest` objects, and slightly improving digest performance
- #1933 - reducing cost of `MessageDigest.getInstance` in general by better 
internal caching of `Constructor` objects, among other things. With this 
there's now no extra allocations when looking up something that has been looked 
up before.

Together these enhancements bring the overheads of `UUID.nameUUIDFromBytes` 
down close to what you can get from cloning from a `ThreadLocal` `MD5` object 
as suggested here. Taking the ambient overheads of `ThreadLocal`s into account 
I'd say it's not worth adding this cache, and would suggest withdrawing this PR 
and closing the RFE.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1821

Reply via email to