473,549 Members | 2,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: mmap class has slow "in" operator

En Thu, 29 May 2008 19:17:05 -0300, Kris Kennaway <kr**@FreeBSD.o rg>
escribió:
If I do the following:

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

return mm.find(string)

def mmap_is_in(f, string):
fh = file(f)
mm = mmap.mmap(fh.fi leno(), 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.
Looks like you should define the sq_contains member in mmap_as_sequenc e,
and the type should have the Py_TPFLAGS_HAVE _SEQUENCE_IN flag set (all in
mmapmodule.c)

--
Gabriel Genellina

Jun 27 '08 #1
0 1111

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2399
by: Lisa S. | last post by:
Can someeone help! This works: SELECT * FROM sometable WHERE 1 IN (1, 2, 3) ; But if I want something like this: s_mylist VARCHAR2(20) := '1, 2, 3'; SELECT * FROM sometable
8
1643
by: Webster | last post by:
Hello, I have a class Shape and subclasses Circle, Rectangle etc. I also have a function to write them to a file given a filepointer. However, I store the colour info in the Shape class. My question is, is it possible to create a WriteColour function in the Shape class, but when I call the sub class writes (i.e. Circle.Write(...)), it...
3
1577
by: Carlo Capelli | last post by:
I found a change in the following code, that behaved correctly in VC++ 6. #include <strstream> using namespace std; void main() { char x; ostrstream(x, 100) << "pippo" << "pluto" << ends; // here x contains "004400C8pluto"
3
10832
by: Steve Richter | last post by:
here is an error I get when I open my class library project: "The class ResultsTable can be designed, but is not the first class in the file. Visual Studio requires that designers use the first class in the file. Move the class code so that it is the first class in the file and try loading the designer again." What does that mean, "the...
11
2686
by: fourfires.d | last post by:
Dear All, I am new to c++ and when write below code that try to call copy constructor in "=" operator overloading, it can not compile. Can anyone point out for me the reason? thanks !! class AA {
9
2186
by: Emanuele Aina | last post by:
I have some code which does a lot of "in" on lists containing objects with no __eq__ defined. It all goes fast until I add the __lt__() method: then I have a slowdown comparable to the one I get using the overridden __eq__, while the __lt__ method is never called. Someone can explain me why?
7
3077
by: eric | last post by:
hello i'm confused by an example in the book "Effective C++ Third Edition" and would be grateful for some help. here's the code: class Person { public: Person(); virtual ~Person(); // see item 7 for why this is virtual ...
4
1551
by: pradeep kaltari | last post by:
Hello friends, I have a doubt in the working of IN operator. I have a schema by name 'test_schema'. If you look at the following query the expected output is "1", but nothing is displayed. SELECT 1 FROM TABLE1 WHERE UPPER( 'test_schema' ) IN ( SELECT UPPER(SCHEMA_NAME) ...
2
1934
by: dhtmlkitchen | last post by:
I'm trying to learn something about JScript engine. I have the following example: <script>(function() { poop = "brown"; myFunction = function myFunction() {}
5
1874
by: tinnews | last post by:
Is there any way in python to say if string1 in string2: <do something> ignoring the case of string1 and string2? I know I could use:-
0
7532
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7462
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7975
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7492
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5101
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3491
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1957
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1069
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.