Add: (closed) preamble

This commit is contained in:
Adam Porter 2019-08-09 17:10:03 -05:00
parent cd4f3cc99b
commit 13993f1394
2 changed files with 35 additions and 0 deletions

View file

@ -430,6 +430,32 @@ Not sure if clearing the cache is necessary here, because it seemed to make near
:action '(org-get-heading t t))))))
#+END_SRC
*** =closed=
#+BEGIN_SRC elisp
(org-ql-preamble-bench :times 1
:file "~/org/inbox.org"
:query (closed))
#+END_SRC
#+RESULTS:
| Form | x faster than next | Total runtime | # of GCs | Total GC runtime |
|-----------------------+--------------------+---------------+----------+------------------|
| preamble: (closed) | 4.80 | 0.086553 | 0 | 0 |
| no preamble: (closed) | slowest | 0.415165 | 0 | 0 |
#+BEGIN_SRC elisp
(org-ql-preamble-bench :times 1
:file "~/org/inbox.org"
:query (closed <= "2019-01-01"))
#+END_SRC
#+RESULTS:
| Form | x faster than next | Total runtime | # of GCs | Total GC runtime |
|---------------------------------------+--------------------+---------------+----------+------------------|
| preamble: (closed <= "2019-01-01") | 4.21 | 0.105782 | 0 | 0 |
| no preamble: (closed <= "2019-01-01") | slowest | 0.445374 | 0 | 0 |
*** =deadline=
#+BEGIN_SRC elisp

View file

@ -316,6 +316,15 @@ replace the clause with a preamble."
element)
(pcase element
(`(or _) element)
(`(closed . ,_)
(setq org-ql-preamble
(rx-to-string `(seq bol (0+ (any " ")) "CLOSED" ":" (1+ space) (1+ not-newline)) t))
;; Return element, because the predicate still needs testing.
element)
(`(closed)
(setq org-ql-preamble (rx-to-string `(seq bol (0+ (any " ")) "CLOSED" ":") t))
;; Return element, because the predicate still needs testing.
element)
(`(deadline . ,_)
(setq org-ql-preamble
(rx-to-string `(seq bol (0+ (any " ")) "DEADLINE" ":" (1+ space) (1+ not-newline)) t))