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
improve performance of libSSL usage on hashing #74288
Comments
To correctly pick the best algorithm for the current architecture, This short change lead to a speedup of 50% on POWER8 when using |
This small change also changes behavior of OpenSSL dramatically. What are your Python and OpenSSL versions? How did you profile the performance of the hashing functions? If OpenSSL_config() really improves performance on relevant platforms, then we should be consistent and call it in _ssl.c, too. |
I tested by compiling my own python3 (8aaf499) against its parent (d6d344d) For python2, I made the same by compiling the 2.7.13 as a baseline and results were consistent with the python I have on Ubuntu 17.10 (3.5.3 and 2.7.13).
I compared the timings between my patched vs patchless python versions by using a 630MB file to calculate sha256 as: perf stat -r 10 Python-2.7.13/python -c "import hashlib; print(hashlib.sha256(open('ubuntu-16.10-server-ppc64el.iso','rb').read()).hexdigest())" The speedup of ~50% is given due to patchless taking 3.082156387s and patched taking 2.027484800s (errors are less than 1%) I also noticed what changed on a code level by checking with gdb what is being executed on the sha loop. After my patch I see altivec (SIMD) functions being used on SHA main loop.
I'll check that then. Thanks for the hint. Ps: please note this behavior is noticed on a POWER8 machine. I'm not an OpenSSL expert so I don't know if there are now more optimizations enabled on other architectures as well. |
What do you mean by "dramatically"? What does a openssl.cnf configuration contain? Do other applications using OpenSSL call OPENSSL_config(NULL)? Since OPENSSL_config() accepts a filename, maybe a first step would be to expose the function as ssl.OPENSSL_config(filename) to allow user to load *explicitly* a configuration file? ssl.OPENSSL_config() would call OPENSSL_config(NULL). Would it work for you, Gustavo? -- More links: |
It would work, I would just wait for such a decision. BTW, that interface is deprecated as we're discussing on the issue on GitHub: I'll continue analyzing this issue there. |
Is there any news on this issue? The PR 3112 also seems to be frozen at the moment. Is there some kind of code freeze happening at the moment that no reviews are taking place? |
Thanks for your persistence and your initial patch. |
No worries. I thank you also for reviewing all these changesets. I'm glad it worked in the end. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: