RE: Replacing characters (Matt: bug)
- Posted by Andy Serpa <renegade at earthling.net> Sep 17, 2002
- 470 views
Dan Moyer wrote: > Some tests (not exhaustive) of the 3 "replace characters" routines > recently > shown here: > > Matt's now doesn't fail on replace last character, but doesn't actually > replace the last character, & is *very* much slower than either of the > other > two > (one test: Henri: 3.9, Andy: 2.75 , Matt: 24.06) ; > > Henri/Mike "vulcan" routine is faster than Matt's but won't replace one > char > with 2; > > Andy's is fastest. How much faster seems to vary. On a "long" sequence > to > peruse, it seemed twice as fast as Henri/Mike "vulcan", but on many > repetitions of replacing in smaller sequence, it seems only 1.4 times > faster > (see test results above). > > I've attached the tests I ran in case I did something dumb in them. > > Now that I think about it, I don't know why I put "10x faster". I did only one test with a short sequence and short replacements, and found mine about 4.5x faster that Henri's (with the "so" sequence removed -- maybe that actually speeds it up?). My unposted "most elegant" version turned out to be slower than both, so I just admired it for a while then erased it...