Message276257
I'm a bit worried that the patch might slow down the general case of SipHash24. When I was working on SipHash24 I made sure that the general case in PyBytes_Object and PyUnicode_Object are fast and always aligned. Do all compilers optimize that case? For MSVC we still have a specialized Py_MEMCPY() variant in pyports.h.
I can see three more ways to fix the issue:
1) Have two loops, one for the aligned case with memcpy() and one for the unaligned case w/o memcpy()
2) Add a special variant of _le64toh() for PY_LITTLE_ENDIAN on ARM and use the current variant on X86_64.
3) Make it illegal to call _Py_HashBytes() with non-aligned pointer and require the caller to provide an aligned buffer. It's easy for datetime but requires an extra buffer memoryview. Memoryview already uses a buffer for all but single-strided C contiguous views. We can easily add another case for non-aligned buffers. |
|
Date |
User |
Action |
Args |
2016-09-13 12:15:41 | christian.heimes | set | recipients:
+ christian.heimes, doko, benjamin.peterson, ztane |
2016-09-13 12:15:41 | christian.heimes | set | messageid: <1473768941.21.0.156315826043.issue28055@psf.upfronthosting.co.za> |
2016-09-13 12:15:41 | christian.heimes | link | issue28055 messages |
2016-09-13 12:15:40 | christian.heimes | create | |
|