Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!SHIRE.CS.PSU.EDU!flee From: flee@SHIRE.CS.PSU.EDU (Felix Lee) Newsgroups: comp.lang.icon Subject: Re: deleting characters Message-ID: <9001200007.AA02947@shire.cs.psu.edu> Date: 20 Jan 90 00:07:40 GMT References: <9001192303.AA01299@zk.cray.com> Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 15 > It turns out that the IPL delete routine was the slowest, although > the fastest was only 15 percent faster. On pathological cases, the delete routine can be much slower. Try removing spaces from repl("a ", 1000). The delete routine is quadratic wrt the length of the source string, while the strip routines are quadratic wrt the result. This is due to the terrible amount of copying involved in manipulating Icon strings: delete has to copy 3997 + 3994 + ... + 1000 characters, while the other procedures need only copy 1 + 2 + ... + 1000. You can get linear performance if you do it in C. -- Felix Lee flee@shire.cs.psu.edu *!psuvax1!flee