Re: FindReplace


Subject: Re: FindReplace
From: sam th (sam@uchicago.edu)
Date: Thu Aug 03 2000 - 21:51:00 CDT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 4 Aug 2000, Allan Shark Clark wrote:

> Hi
> Fiddling around with the find and replace, I have changed it so that it
> uses what I think is a faster string matching algorithm. Find the patch
> attached.

Have you done any profiling of this? Do you have any good test cases (I
can do some profiling for you)?

> There are still a couple of issues, one is the "magic number" where we
> struggle if the document is massive, we have at the moment a foundAt
> variable declared as a UT_sint32 and set to -1 which we later check to see
> if we have found the string, I thought a quick fix for just now would be to
> use an UT_uint32, this would give us twice the document size, we could
> initialize it to the maxium for an int and then test to see if it was still
> that value when we want to know if the string has been found (true this
> would fail a bit if the string was found in that exact position but I don't
> think that's going to happen very often and the current method would fail
> anyway), I can't help thinking there is something wrong with this idea
> though, someone please point out the obvious that I'm missing.

As Martin pointed out, this mostly won't be neccessary. However, if it
has *no* negative impact on performance for short documents, then it's
fine.

> Secondly I'm going to change the findNext and _findNext functions to accept
> another argument which would be the prefix function of the find string, this
> would mean computing the prefix function could be done in the Replace dialog
> code that way when we do a ReplaceAll we don't have to continually
> re-compute the prefix function.

Sounds good.

> I'll try it anyway see how it goes.
> Lastly once I have done that I was thinking of having a crack at
> implementing searching for regular expressions, just wanted to make sure
> that no-one else was currently working on this as I don't want to duplicate
> effort.

As long as no one who doesn't ask to even *sees* the term "regular
expressions when not neccessary.
           
                                     sam th
                                     sam@uchicago.edu
                                http://www.abisource.com/~sam/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5ii+Wt+kM0Mq9M/wRAuliAJ45eNpLVl8h8pJ7/IMBsybfMR5lKgCglalR
HjINGtGR/WZNrh8zrG5h2ds=
=2EJZ
-----END PGP SIGNATURE-----



This archive was generated by hypermail 2b25 : Thu Aug 03 2000 - 20:43:07 CDT