bpo-46848: Optimize mmap.find() with memmem(3)#31554
bpo-46848: Optimize mmap.find() with memmem(3)#31554rumpelsepp wants to merge 4 commits intopython:mainfrom
Conversation
|
Will fix the failing tests ASAP. |
2fd87a0 to
7f81d2d
Compare
|
Another thing you could try out and compare is using the fastsearch functions defined in Objects/stringlib, which should generally be faster than that naive loop and also platform independent. |
Modules/mmapmodule.c
Outdated
There was a problem hiding this comment.
The function is not specified in POSIX standard. Please add a feature check to configure.ac and check for HAVE_MEMMEM.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
e378cef to
6fb16fd
Compare
|
#31625 provides a platform independent proposal. |
This merge requests optimizes
mmap.find()by using libc'smemmem(3)function (which is optimized) instead of using a trivial for loop. I could not find an equivalent solution formmap.rfind()yet.The following snippet runs 100% faster with this patch applied. The file used is a logfile of 2.3 GB size
With this patch applied:
Without this patch:
https://bugs.python.org/issue46848