From: Christopher Genovese <genovese@cmu.edu>
To: Martin Pohlack <mp26@os.inf.tu-dresden.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: new tag query parser [1/5] -- the motivating issues
Date: Sat, 18 Aug 2012 14:10:33 -0400 [thread overview]
Message-ID: <CAPum5FgXdxW3=w33wSC7bdL7E4baSx2warPV6SjjHq6Wx767Lg@mail.gmail.com> (raw)
In-Reply-To: <502FA424.4010004@os.inf.tu-dresden.de>
[-- Attachment #1: Type: text/plain, Size: 2958 bytes --]
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
<mp26@os.inf.tu-dresden.de>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
>
>
[-- Attachment #2: Type: text/html, Size: 3440 bytes --]
prev parent reply other threads:[~2012-08-18 18:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-16 3:57 new tag query parser [1/5] -- the motivating issues Christopher Genovese
2012-08-18 14:18 ` Martin Pohlack
2012-08-18 18:10 ` Christopher Genovese [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPum5FgXdxW3=w33wSC7bdL7E4baSx2warPV6SjjHq6Wx767Lg@mail.gmail.com' \
--to=genovese@cmu.edu \
--cc=emacs-orgmode@gnu.org \
--cc=mp26@os.inf.tu-dresden.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).