Re: Sequence Slicing (Was RE: Tough ciphers?)
- Posted by Robert Craig <rds at RapidEuphoria.com> Mar 14, 2002
- 432 views
C.K. Lester writes: > Anybody got any tips, tricks, or hints about faster slicing of > sequences? > > They are of the pattern > > x = x[a+1..length(x)] > > so, I'm assigning a slice of x back to x. > Should I assign it to another variable instead? In some cases it will be faster if you assign it to itself. Given the right conditions (single reference count, fairly large slice), it will not copy anything. It will simply adjust the start and end pointers of the sequence. > What can I do to make a significant difference, if anything? Obviously you are doing this slice statement many times inside some kind of loop. You'd have to ask yourself if that's really necessary. I don't think we can help you without knowing how this fits into your overall algorithm. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com