467,073 Members | 1,262 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,073 developers. It's quick & easy.

mmap class has slow "in" operator

If I do the following:

def mmap_search(f, string):
fh = file(f)
mm = mmap.mmap(fh.fileno(), 0, mmap.MAP_SHARED, mmap.PROT_READ)

return mm.find(string)

def mmap_is_in(f, string):
fh = file(f)
mm = mmap.mmap(fh.fileno(), 0, mmap.MAP_SHARED, mmap.PROT_READ)

return string in mm

then a sample mmap_search() call on a 50MB file takes 0.18 seconds, but
the mmap_is_in() call takes 6.6 seconds. Is the mmap class missing an
operator and falling back to a slow default implementation? Presumably
I can implement the latter in terms of the former.

Kris
Jun 27 '08 #1
  • viewed: 904
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Lisa S. | last post: by
8 posts views Thread by Webster | last post: by
3 posts views Thread by Carlo Capelli | last post: by
11 posts views Thread by fourfires.d@gmail.com | last post: by
9 posts views Thread by Emanuele Aina | last post: by
2 posts views Thread by dhtmlkitchen@gmail.com | last post: by
5 posts views Thread by tinnews@isbd.co.uk | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.