emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] new tag query parser [1/5] -- the motivating issues


From: Christopher Genovese
Subject: Re: [O] new tag query parser [1/5] -- the motivating issues
Date: Sat, 18 Aug 2012 14:10:33 -0400

Hi Martin,

   Assuming that org.el (with the new parser code) is byte-compiled, the performance
difference is very minor. The only difference comes in converting the query string
to a matcher form. The new parser has some additional overhead in function calls and
keeping track of state, but in practice it is negligible.

   For example, in some basic benchmarks, both parsers can convert 10,000 fairly
complex query strings in a second or two *total*. If you run the tests, you'll see that it does
over 200 cases plus comparisons and a good deal of other stuff in a blink of an eye.

   So for any given agenda search or entry mapping, users will not notice any real difference.

   Regarding backward compatibility, there is no conversion necessary. All currently
valid queries produce equivalent matchers with the new code. The new parser extends
the grammar to incorporate features that would not produce valid matchers with current
code: parenthesized expressions, spaces, and {}-escapes in regexp matches.

    The only issue in this regard is that I added the name HEADING
to the list of special properties (like LEVEL, CATEGORY, PRIORITY, etc.).
This allows heading matches, which is one of my favorite features. So existing
queries with a user-defined property HEADING would match the real heading rather
than the property. This seems like a minor issue to me, but it would need to be noted.

     Regards,

      Christopher

P.S. The provision above (and in the original posts) about byte compiling the
parser code (which would be in org.el) relates to macro-expansion overhead.
I use a macro that makes the new parser function more readable and maintainable,
and does much of its work at compile time to produce faster code.
In interpreted code that macro is expanded each pass through the loop.
The macro could be eliminated if necessary, or made faster in interpreted code by
various tricks (that would add some overhead to compiled code).
But since org.el is typically  byte compiled during installation, this doesn't seem
to me to be a problem. Performance is fine in practice either way, though faster in
the typical compiled case, and I think the clarity gained from the macro is worthwhile.

But definitely byte compile the new code before testing, as I advise in the posts.

On Sat, Aug 18, 2012 at 10:18 AM, Martin Pohlack <address@hidden> wrote:
Hi Christopher,

If I understand your descriptions correctly, your proposed changes are
very cool.

Could you elaborate a little bit on performance?

* Are we going to see speedups?  In what cases?  How much?

* If we lose performance, could you quantify that a bit with some examples?

A question regarding backwards compatibility (I might have missed that
in the description, sorry):  Are you converting existing queries on the
fly each time, or do we have to convert our queries once?  If yes, is
there some assisting code?

Thanks,
Martin



reply via email to

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