On 15/09/2014, at 1:56 PM, john skaller wrote: > Not surprised at all. I could speed this up heaps and heaps!! > > fun rev_split (x:string, d:char): List::list[string] = { > fun aux (x:string,y:List::list[string]) => > match find (x, d) with > | None => Cons (x, y) > | Some ?n => aux$ x.[n+1 to], List::Cons (x.[to n],y) > endmatch > ; > return aux$ x, List::Empty[string]; > }
So using instead: fun rev_split (x:string, d:string): List::list[string] = { fun aux (pos:int,y:List::list[string]) => match stl_find_first_of (x, d, pos) with | $(stl_npos.int) => y | ?n => aux$ (n+1), List::Cons (x.[pos to n],y) endmatch ; return aux$ 0, List::Empty[string]; } I get this: Time elapsed: 0.785302s, 56424 trx, or 71850 trx/sec which is almost twice as fast as this: Felix: Time elapsed: 1.438417s, 56723 trx, or 39434 trx/sec -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language