Tommaso Cucinotta wrote:
Hello,

please, find attached a preliminary patch implementing the idea.
Now, each paragraph that does not contain any match is only stringified
once, then we switch to the next one. When a matching paragraph
is found, it is searched for more carefully by going pos by pos.

Improvement w.r.t. the old unconditional pos-by-pos search is significant
(search in the math manual completes in a few seconds with debug enabled).

Forward search seems ok, backward search has problems, but I'd like to
collect preliminary comments about the approach.

Also, I had to add a ::stringify() method in Paragraph, that mimics the old
behaviour of the Paragraph::asString(), as now the latter method seems
to have been switched to a ToC-oriented usage.

Hi Tommaso,

I think we are advancing towards the 'binary search' goal ;-)
Instead of adding this stringify() method, I would rather add a Paragraph::find() method. Then the actual searching would be done by the paragraph class that knows all that need to be known. This would also avoid the string copying all other the place.

Abdel.

Reply via email to