Support for new items in set type

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Apr 23 03:08:08 EDT 2007


En Mon, 23 Apr 2007 02:17:49 -0300, Prateek <surekap at gmail.com> 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 implementation:
> class SeaSet(set):
[...]

> The surprising thing is that commits *ARE* running about 50% faster
> (according to the time column in the hotshot profiler). But, now, the
> longest running operations seem to be the I/O operations which are
> taking 10 times longer! (even if they're only reading or writing a few
> bytes. Could this have something to do with the set implementation
> being in Python as opposed to C?

Hard to tell - you have posted only your SeaSet implementation, and no I/O  
is involved in that code.

> For instance, this method:
> 	def __readTableHeader(self, f):
> 		hdr = f.read(sz__TABLE_HEADER_FORMAT__)
> 		if len(hdr) < sz__TABLE_HEADER_FORMAT__:
> 			raise EOFError
> 		t = THF_U(hdr)
> 		#t = unpack(__TABLE_HEADER_FORMAT__, hdr)
> 		return t
>
> is now taking > 13s when it was taking less than 0.8s before! (same
> number of calls, nothing changed except the set implementation)

I don't see where your SeaSet class is used.

-- 
Gabriel Genellina



More information about the Python-list mailing list