emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [elpa] master 5640cd0 04/12: el-search: some comment changes


From: Michael Heerdegen
Subject: Re: [elpa] master 5640cd0 04/12: el-search: some comment changes
Date: Mon, 12 Oct 2015 11:46:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Artur Malabarba <address@hidden> writes:

> On 11 Oct 2015 11:33 am, "Michael Heerdegen" <address@hidden>
> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]