Re: Interesting Experiment With String/Sequence Slicing
- Posted by slie at theage.fairfax.com.au Aug 20, 2001
- 433 views
hi Robert, sorry to keep bring this issue up as the program i am writting seems to be severely affected by the slowness in the string slicing function in euphoria. the program i'm working on is basically doing a lot of string string and replace (for large text files) which relies much on the string slicing. i am just curious as to ways the program can be optimised and i have run out of avenues except looking how i can get around the slicing issue. in my last email i wrote : >>my conclusion from this test is that the either the slicing or the >>allocation method in the interpreter is 'iterative' as opposed to just cutting and >>moving large chunks of string around in the memory, which explains the poor perfomance? i am just wild guessing here, but could it be true that a function can be specifically written to deal with string type sequences and so speeding up the slicing function? regards, sam lie Down Under, Australia ----- Original Message ----- From: "Robert Craig" <rds at RapidEuphoria.com> To: "EUforum" <EUforum at topica.com> Sent: Friday, August 17, 2001 2:23 AM Subject: Re: Interesting Experiment With String/Sequence Slicing > > slie writes: > <several examples of slicing> > > Without going through your examples in detail, > I'll just give you a few hints: > > 1. Whenever you see: > > x = y > > nothing happens except for a pointer being copied. > and maybe a reference count being incremented. > If y is a sequence, x and y will now point at a single > copy of the same sequence. > > 2. When you see: > > y = x[a..b] > > Then the data from a to b is copied and a new sequence is > created. (Back in v1.4 and earlier I used to just have y point at the data > in x that it needed, but I later changed this). > > 3. When you see: > > x = x[a..b] > > and there are no other references to the sequence, > then I simply adjust the pointers to the beginning and end of x, > without copying anything. If I am left with a huge amount of > unused space, then I might decide to free it up. > > Regards, > Rob Craig > Rapid Deployment Software > http://www.RapidEuphoria.com > > > > > > ********************************************************************************* This email and any files transmitted with it may be legally privileged and confidential. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. If you have received this email in error, please notify us by return email and permanently delete the document. *********************************************************************************