Opened 18 years ago

Last modified 17 years ago

#548 enhancement closed invalid (invalid)

twisted.spread.util.StringPager.nextPage makes tons of string copies

Reported by: Jean-Paul Calderone Owned by:
Priority: low Milestone:
Component: Keywords:
Cc: Jean-Paul Calderone, itamarst Branch:


Change History (4)

comment:1 Changed 18 years ago by Jean-Paul Calderone

Turning StringPager into a zero-copy pager is easy:

RCS file: /cvs/Twisted/twisted/spread/,v
retrieving revision 1.12
diff -u -r1.12
---     15 Jan 2004 04:04:40 -0000      1.12
+++     8 Mar 2004 01:15:48 -0000
@@ -139,7 +139,7 @@
         Pager.__init__(self, collector, callback, *args, **kw)
     def nextPage(self):
-        val = self.string[self.pointer:self.pointer+self.chunkSize]
+        val = buffer(self.string, self.pointer, self.pointer + self.chunkSize)
         self.pointer += self.chunkSize
         if self.pointer >= len(self.string):

comment:2 Changed 18 years ago by Glyph

Is buffer() really going to stay around in future Python releases?

comment:3 Changed 17 years ago by Jean-Paul Calderone

This seems stupid, in retrospect.

comment:4 Changed 11 years ago by <automation>

Owner: itamarst deleted
Note: See TracTickets for help on using tickets.