RE: Faster..less memory

new topic     » topic index » view thread      » older message » newer message

Hi Kat,

    Just wondering what did u mean by extra tricks? the code below is a 
real memory and timesaver and if you explain exactly what you want your 
deparse() to do, i can do some changes and have a very fast and less 
memory consuming routine.

Also, incase u don't like it? could u make 2 versions of deparse()? i 
really want people to start using that routine especially for those that 
handle large data...

Maybe i should stop, bye

Jordah
Kat wrote:
> On 24 Oct 2002, at 11:55, jordah ferguson wrote:
> 
> > 
> > Hi all,
> > for those of you who use strtok routines. here is a faster deparse that 
> > uses 4 times less memory. i used to get my program running out of memory 
> > 
> > using the old routine. 
> > 
> > Enjoy, AND ladies and gentlemen, please start posting interesting code 
> > fragments you come up with. cause many small cool routines are ignored 
> > in bulky source code
> > 
> > Jordah Ferguson
> 
> Note this won't support the current strtok-v2 release, which allows 
> deparsing 
> on multiple separators at once. Neither will it support v3, which has 
> another 
> trick,, err, ability.
> 
> Kat
> 
> > function deparse(sequence s,integer c)
> >    integer L1,L2,X1,X2 
> >    sequence R
> >    atom M   
> >    L1 = length(s) 
> >    if L1 then
> >       L2 = (L1 - 1)   
> >       for n = 1 to L1 by 1 do
> >      L2 = L2 + length(s[n])
> >       end for
> >       M = machine_func(16, L2) 
> >       X1 = 0
> >       for n = 1 to L1 by 1 do
> >      R = s[n]
> >      X2 = X1 + length(R)
> >      poke(M + X1,R)          
> >      poke(M + X2,c) 
> >      X1 = X2 + 1
> >       end for
> >       R = peek({M,X2})
> >       machine_proc(17,M)
> >       return R
> >    end if
> >    return s
> > end function
> > 
> >

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu