1. Sequence Slicing (Was RE: Tough ciphers?)
- Posted by "C. K. Lester" <cklester at yahoo.com> Mar 14, 2002
- 421 views
Rob, I expect some answers... :) > ...although I'm beginning to understand the ex.pro file The three highest times in my ex.pro file are 18.44, 22.68, and 20.06. The rest of lines that show up, if at all, are usually (99%) 0.XX. The three time hogs are sequence slicing calls!!! 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? What can I do to make a significant difference, if anything? BTW, the second time hog is actually a find(s1,s2) call, so I just know a binary tree or hash list would make things much faster on that one. :)
2. Re: Sequence Slicing (Was RE: Tough ciphers?)
- Posted by Robert Craig <rds at RapidEuphoria.com> Mar 14, 2002
- 433 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
3. Re: Sequence Slicing (Was RE: Tough ciphers?)
- Posted by euman at bellsouth.net Mar 14, 2002
- 411 views
----- Original Message ----- From: "C. K. Lester" <cklester at yahoo.com> > They are of the pattern > > x = x[a+1..length(x)] sequence z integer aout aout = a + 1 integer lenx lenx = length(x) z = repeat(0, lenz - aout) for i = aout to lenx do z[i] = x[i] end for x = z -- or just leave it z instead of the extra copy if you want! BTW, completly untested to work or for speed but I imagine this might be faster....... Euman
4. Re: Sequence Slicing (Was RE: Tough ciphers?)
- Posted by euman at bellsouth.net Mar 14, 2002
- 423 views
> ----- Original Message ----- > From: "C. K. Lester" <cklester at yahoo.com> > > They are of the pattern > > > > x = x[a+1..length(x)] > Woops, made a mistake in the first one lets try again... Lets see if this works now. sequence z integer aout aout = a + 1 integer lenx lenx = length(x) - aout z = repeat(0, lenx) for i = 1 to lenx do z[i] = x[i] end for x = z -- or just leave it z instead of the extra copy if you want! BTW, completly untested to work or for speed but I imagine this might be faster....... Euman
5. Re: Sequence Slicing (Was RE: Tough ciphers?)
- Posted by euman at bellsouth.net Mar 14, 2002
- 430 views
Last try.....then Im going to bed. sequence z integer aout integer lenx integer j aout = a + 1 lenx = length(x) z = repeat(0, lenx - aout) j = 0 for i = aout to lenx do j += 1 z[j] = x[i] end for x = z Euman euman at bellsouth.net
6. Re: Sequence Slicing (Was RE: Tough ciphers?)
- Posted by Mike Nelson <MichaelANelson at WORLDNET.ATT.NET> Mar 16, 2002
- 435 views
Chris' results with range_find() are comparable to bechmarks from a while ago about a binary searcj routine vs. find on a sorted sequence--the break even point is about 300 for sequence data and about 500 for integer data. For the specific case of finding the last element of a sequence of 10,000 strings, the benchmark varies quite a bit based on how different the non-matching strings are from the search string: the fastest times are when the other strings are a different length, the next fastest when the first character is different, then when the second character is different, etc. --Mike Nelson