* Re: [elpa] master 5640cd0 04/12: el-search: some comment changes
2015-10-11 23:29 ` [elpa] master 5640cd0 04/12: el-search: some comment changes Artur Malabarba
@ 2015-10-12 9:46 ` Michael Heerdegen
0 siblings, 0 replies; 2+ messages in thread
From: Michael Heerdegen @ 2015-10-12 9:46 UTC (permalink / raw)
To: emacs-devel
Artur Malabarba <bruce.connor.am@gmail.com> writes:
> On 11 Oct 2015 11:33 am, "Michael Heerdegen" <michael_heerdegen@web.de>
> wrote:
> > + ;; FIXME: an interesting alternative would be to really integrate it
> > + ;; with Isearch, using `isearch-search-fun-function'.
> > + ;; Alas, this is not trivial if we want to transfer our optimizations.
> > (interactive)
> > (el-search-pattern
> > (el-search--read-pattern
>
> Can you explain why? I've been thinking of making some refactorings to
> isearch (after the feature freeze) and I could try to extend
> isearch-search-fun-function to cover your use case if it's not too
> hard.
That's great news. When I added the "this is not trivial if we want to
transfer our optimizations" to the comment, I didn't take changing
isearch itself into account.
I use two optimization techniques at the moment:
(1) Cache the current expanded pcase call, to avoid costly repeated pcase
expansion. Probably not problematic wrt isearch.
(2) The most time consuming part while searching is getting to the start
of the next sexp, because it is done so often.
The optimization I recently added factors the function that does that
into two parts:
- The first part is called only when starting a new search. It
performs costly tests (calling syntax functions), moves out of
comments, and such stuff. It guarantees to leave point at a position
that fulfills a certain set of conditions, let's call it C.
- The second part is very fast. Once C holds, it's sufficient to call
it repeatedly.
(2) makes a huge change in efficiency (factor 5 or so). The problem is
that because of (2), it's not possible to pass a function to isearch
that finds the next match from any place and is optimized in that way.
If you have an idea how to optimize the "move point to the next start of
an expression" further or better, I'm open ear.
BTW, I don't yet have implemented backward searching.
Regards,
Michael.
^ permalink raw reply [flat|nested] 2+ messages in thread