Re: matching strings in a large set of strings

2010-05-06 Thread M.-A. Lemburg
Dennis Lee Bieber wrote: On Thu, 29 Apr 2010 11:38:28 +0200, Karin Lagesen karin.lage...@bio.uio.no declaimed the following in comp.lang.python: Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is

Re: matching strings in a large set of strings

2010-05-03 Thread Bryan
Karin Lagesen wrote: I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. [...] I run out of memory building both the set and the dictionary, so what I seem to be left with is

Re: matching strings in a large set of strings

2010-05-02 Thread Albert van der Horst
In article 877hnpjtdw@rudin.co.uk, Paul Rudin paul.nos...@rudin.co.uk wrote: Karin Lagesen karin.lage...@bio.uio.no writes: Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83

Re: External Hashing [was Re: matching strings in a large set of strings]

2010-05-01 Thread Jack
http://www.swizwatch.com/ All Cartier replica watches sold at Hotwristwatch.com are brand-new and high quality. Each Cartier Replica Watch produced is examined carefully by our quality test department and each watch is inspected again before being sent to our customer. It is our desire that you do

Re: matching strings in a large set of strings

2010-05-01 Thread News123
Dennis Lee Bieber wrote: On Thu, 29 Apr 2010 11:38:28 +0200, Karin Lagesen karin.lage...@bio.uio.no declaimed the following in comp.lang.python: Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is

Re: matching strings in a large set of strings

2010-05-01 Thread Stefan Behnel
Duncan Booth, 30.04.2010 10:20: So more than 3GB just for the strings (and that's for Python 2.x on Python 3.x you'll need nearly 5GB). Running on a 64 bit version of Python should be fine, but for a 32 bit system a naive approach just isn't going to work. Option 1: use a trie. That should

Re: matching strings in a large set of strings

2010-05-01 Thread News123
Dennis Lee Bieber wrote: On Sat, 01 May 2010 13:48:02 +0200, News123 news1...@free.fr declaimed the following in gmane.comp.python.general: Dennis Lee Bieber wrote: That lets you do a binary search on the file. Much faster than a linear search (linear search will average out to 41.5M

Re: matching strings in a large set of strings

2010-04-30 Thread Paul Rudin
Karin Lagesen karin.lage...@bio.uio.no writes: Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. Now, I have tried storing these strings as a list, a set and a

Re: matching strings in a large set of strings

2010-04-30 Thread Duncan Booth
Paul Rudin paul.nos...@rudin.co.uk wrote: Shouldn't a set with 83 million 14 character strings be fine in memory on a stock PC these days? I suppose if it's low on ram you might start swapping which will kill performance. Perhaps the method you're using to build the data structures creates

Re: matching strings in a large set of strings

2010-04-30 Thread Steven D'Aprano
On Fri, 30 Apr 2010 08:23:39 +0100, Paul Rudin wrote: Karin Lagesen karin.lage...@bio.uio.no writes: Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. Now, I

Re: matching strings in a large set of strings

2010-04-30 Thread Paul Rudin
Duncan Booth duncan.bo...@invalid.invalid writes: Paul Rudin paul.nos...@rudin.co.uk wrote: Shouldn't a set with 83 million 14 character strings be fine in memory on a stock PC these days? I suppose if it's low on ram you might start swapping which will kill performance. Perhaps the method

Re: matching strings in a large set of strings

2010-04-30 Thread Christian Heimes
s = 12345678901234 assert len(s) == 14 import sys sys.getsizeof(s) 38 So a single 14 char string takes 38 bytes. Make that at least 40 bytes. You have to take memory alignment into account. So a set with 83000 such strings takes approximately 1 MB. So far fairly trivial. But that's just the

External Hashing [was Re: matching strings in a large set of strings]

2010-04-30 Thread Helmut Jarausch
I think one could apply an external hashing technique which would require only very few disk accesses per lookup. Unfortunately, I'm now aware of an implementation in Python. Does anybody know about a Python implementation of external hashing? Thanks, Helmut. -- Helmut Jarausch Lehrstuhl fuer

Re: External Hashing [was Re: matching strings in a large set of strings]

2010-04-30 Thread Tim Chase
On 04/30/2010 12:51 PM, Helmut Jarausch wrote: I think one could apply an external hashing technique which would require only very few disk accesses per lookup. Unfortunately, I'm now aware of an implementation in Python. Does anybody know about a Python implementation of external hashing?

Re: External Hashing [was Re: matching strings in a large set of strings]

2010-04-30 Thread Dave Angel
Helmut Jarausch wrote: I think one could apply an external hashing technique which would require only very few disk accesses per lookup. Unfortunately, I'm now aware of an implementation in Python. Does anybody know about a Python implementation of external hashing? Thanks, Helmut. That's

matching strings in a large set of strings

2010-04-29 Thread Karin Lagesen
Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. Now, I have tried storing these strings as a list, a set and a dictionary. I know that finding things in a set and a

Re: matching strings in a large set of strings

2010-04-29 Thread Peter Otten
Karin Lagesen wrote: I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. Now, I have tried storing these strings as a list, a set and a dictionary. I know that finding

Re: matching strings in a large set of strings

2010-04-29 Thread Stefan Behnel
Karin Lagesen, 29.04.2010 11:38: I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. Now, I have tried storing these strings as a list, a set and a dictionary. I know that

Re: matching strings in a large set of strings

2010-04-29 Thread Mark Tolonen
Karin Lagesen karin.lage...@bio.uio.no wrote in message news:416f727c6f5b0edb932b425db9579808.squir...@webmail.uio.no... Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million

Re: matching strings in a large set of strings

2010-04-29 Thread MRAB
Karin Lagesen wrote: Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. Now, I have tried storing these strings as a list, a set and a dictionary. I know that finding

Re: matching strings in a large set of strings

2010-04-29 Thread Duncan Booth
MRAB pyt...@mrabarnett.plus.com wrote: Karin Lagesen wrote: Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. Now, I have tried storing these strings as a

Re: matching strings in a large set of strings

2010-04-29 Thread Miki
I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. Have a look at the shelve module. If you want to write the algorithm yourself, I suggest http://en.wikipedia.org/wiki/Trie

Re: matching strings in a large set of strings

2010-04-29 Thread Terry Reedy
On 4/29/2010 5:38 AM, Karin Lagesen wrote: Hello. I have approx 83 million strings, all 14 characters long. I need to be able to take another string and find out whether this one is present within the 83 million strings. If the 'other string' is also 14 chars, so that you are looking for