Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance tweak when creating md5 digest #29

Closed
GoogleCodeExporter opened this issue Apr 7, 2016 · 2 comments
Closed

Performance tweak when creating md5 digest #29

GoogleCodeExporter opened this issue Apr 7, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link
Contributor

Using:
memcached-2.0.2.jar
spy.jar vers. 2.4

In HashAlgorithm.computeMd5() the MessageDigest gets created for every
call. I guess this can reduce performance. Creating the digest in a static
way during initialization of the class and synchronizing on md5 during
reset(), update() and digest() might help to improve performance. 

Original issue reported on code.google.com by misch...@gmail.com on 13 May 2008 at 3:57

@GoogleCodeExporter
Copy link
Contributor Author

This measures slower on my machine:

5 threads, 10 in pool, mode: NEW
Processing time:  71ms
15 threads, 10 in pool, mode: NEW
Processing time:  229ms
50 threads, 10 in pool, mode: NEW
Processing time:  776ms
5 threads, 10 in pool, mode: LOCKED
Processing time:  102ms
15 threads, 10 in pool, mode: LOCKED
Processing time:  331ms
50 threads, 10 in pool, mode: LOCKED
Processing time:  1166ms

Run the attached test to try it against yours.

Original comment by dsalli...@gmail.com on 14 May 2008 at 3:28

  • Changed state: Invalid

Attachments:

@GoogleCodeExporter
Copy link
Contributor Author

BTW, if performance is a concern, you should really use a different hash.  md5 
was
designed to be of cryptographic quality, not for performance.

Original comment by dsalli...@gmail.com on 14 May 2008 at 3:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant