Re: Support for new items in set type

2007-04-26 Thread Raymond Hettinger
[Alex Martelli] > In your shoes, I would write a class whose instances hold three sets: > -- the "master set" is what you originally read from the file > -- the "added set" is the set of things you've added since then > -- the "deleted set" is the set of things you've deleted since them FWIW, I've

Re: Support for new items in set type

2007-04-23 Thread Prateek
> I don't see where your SeaSet class is used. > Actually that is the point. According to the hotshot profile, the problem code doesn't use the SeaSet implementation. Yet that same code was running much faster earlier. I tried multiple time (2-3 times). >From what I can fathom, nothing else changed

Re: Support for new items in set type

2007-04-23 Thread Gabriel Genellina
En Mon, 23 Apr 2007 02:17:49 -0300, Prateek <[EMAIL PROTECTED]> escribió: > Oh dear god, I implemented this and it overall killed performance by > about 50% - 100%. The same script (entering 3000 items) takes between > 88 - 109s (it was running in 55s earlier). > > Here is the new Set implementati

Re: Support for new items in set type

2007-04-22 Thread Prateek
Oh dear god, I implemented this and it overall killed performance by about 50% - 100%. The same script (entering 3000 items) takes between 88 - 109s (it was running in 55s earlier). Here is the new Set implementation: class SeaSet(set): __slots__ = ['master', 'added', 'deleted'] de

Re: Support for new items in set type

2007-04-22 Thread Aahz
In article <[EMAIL PROTECTED]>, Prateek <[EMAIL PROTECTED]> wrote: > >Thanks Alex, but we're actually implementing a (non-relational) >database engine. Why are you reinventing the wheel? Why not just implement your functionality on top of an existing database as your backing store? -- Aahz ([E

Re: Support for new items in set type

2007-04-22 Thread Prateek
> > 2) Maintaining a copy wastes memory > > 3) I don't have a good solution if I delete items from the set > > (calculating the difference will return an empty set but I need to > > actually delete stuff). > > (3) is easy -- the difference originalset-finalset is the set of things > you have to de

Re: Support for new items in set type

2007-04-22 Thread Prateek
On Apr 22, 11:09 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 21 Apr 2007 20:13:44 -0700, Prateek wrote: > > I have a bit of a specialized request. > > > I'm reading a table of strings (specifically fixed length 36 char > > uuids generated via uuid.uuid4() in the standard library) from

Re: Support for new items in set type

2007-04-21 Thread Steven D'Aprano
On Sat, 21 Apr 2007 20:13:44 -0700, Prateek wrote: > I have a bit of a specialized request. > > I'm reading a table of strings (specifically fixed length 36 char > uuids generated via uuid.uuid4() in the standard library) from a file > and creating a set out of it. > Then my program is free to ma

Re: Support for new items in set type

2007-04-21 Thread Alex Martelli
Prateek <[EMAIL PROTECTED]> wrote: > I have a bit of a specialized request. > > I'm reading a table of strings (specifically fixed length 36 char > uuids generated via uuid.uuid4() in the standard library) from a file > and creating a set out of it. > Then my program is free to make whatever modi