Re: Slow execution
- --- In firstname.lastname@example.org, Axel Berger <Axel-Berger@...> wrote:
>Your pattern is doing a lot of backtracking. Following might make an improvement in speed.
> I have a file of about 13 000 lines of which about one in ten is link.
> When running a clip on it, everything - dozens of document-wide replaces
> - executes quite fast, except this bit:
> ^!Replace "~" >> "˜" WTAS
> ^!Jump TEXT_START
> ^!Find "(?s)HREF="(http.+?)"(.*?)>" RS1
> ^!IfError Weiter
> ; start long line
> ; end long line
> ^!InsertText ^$FileToUrl("^$GetSelection$")$
> ^!Goto Loop
> ^!Replace "˜" >> " " WTAS
> It starts off quick enough but slows down all through the file and
> towards the end is something like a second per loop. Screen update off
> does not do anything noticeable. The code snipped is part of a clip
> called through ^!FarClip from an outer one.
> Is there a way to speed things up in this loop?
> N.B: In TeX notation but not of course inside URLs a tilde denotes a
> non-breaking space. That's what the two outer replaces deal with.
^!Find "(?s)HREF="(http.+?)"(.*?)>" RS1
^!Find "(?<=HREF=\x22)http[^\x22>]++(?=\x22[^>]*+>)" RS