Add: (scheduled) preamble

This commit is contained in:
Adam Porter 2019-08-09 17:07:49 -05:00
parent ed26effe1c
commit cd4f3cc99b
2 changed files with 35 additions and 0 deletions

View file

@ -508,6 +508,32 @@ Not sure if clearing the cache is necessary here, because it seemed to make near
| preamble: (property "agenda-group" "plans") | 72.54 | 0.016862 | 0 | 0 | | preamble: (property "agenda-group" "plans") | 72.54 | 0.016862 | 0 | 0 |
| no preamble: (property "agenda-group" "plans") | slowest | 1.223197 | 0 | 0 | | no preamble: (property "agenda-group" "plans") | slowest | 1.223197 | 0 | 0 |
*** =scheduled=
#+BEGIN_SRC elisp
(org-ql-preamble-bench :times 1
:file "~/org/inbox.org"
:query (scheduled))
#+END_SRC
#+RESULTS:
| Form | x faster than next | Total runtime | # of GCs | Total GC runtime |
|--------------------------+--------------------+---------------+----------+------------------|
| preamble: (scheduled) | 4.45 | 0.100968 | 0 | 0 |
| no preamble: (scheduled) | slowest | 0.449321 | 0 | 0 |
#+BEGIN_SRC elisp
(org-ql-preamble-bench :times 1
:file "~/org/inbox.org"
:query (scheduled <= "2019-01-01"))
#+END_SRC
#+RESULTS:
| Form | x faster than next | Total runtime | # of GCs | Total GC runtime |
|------------------------------------------+--------------------+---------------+----------+------------------|
| preamble: (scheduled <= "2019-01-01") | 4.13 | 0.111067 | 0 | 0 |
| no preamble: (scheduled <= "2019-01-01") | slowest | 0.458726 | 0 | 0 |
*** =tags= *** =tags=
If tag inheritance is enabled, we have to check tags on every heading. When it's disabled, we can search directly to headings with the given tags. If tag inheritance is enabled, we have to check tags on every heading. When it's disabled, we can search directly to headings with the given tags.

View file

@ -375,6 +375,15 @@ replace the clause with a preamble."
;; (setq org-ql-preamble (rx-to-string `(seq bol (0+ space) ":" (1+ (not (or space ":"))) ":" ;; (setq org-ql-preamble (rx-to-string `(seq bol (0+ space) ":" (1+ (not (or space ":"))) ":"
;; (1+ space) (minimal-match (1+ not-newline)) eol))) ;; (1+ space) (minimal-match (1+ not-newline)) eol)))
;; element) ;; element)
(`(scheduled . ,_)
(setq org-ql-preamble
(rx-to-string `(seq bol (0+ (any " ")) "SCHEDULED" ":" (1+ space) (1+ not-newline)) t))
;; Return element, because the predicate still needs testing.
element)
(`(scheduled)
(setq org-ql-preamble (rx-to-string `(seq bol (0+ (any " ")) "SCHEDULED" ":") t))
;; Return element, because the predicate still needs testing.
element)
((and `(tags . ,tags) (guard (not org-use-tag-inheritance))) ((and `(tags . ,tags) (guard (not org-use-tag-inheritance)))
;; When tag inheritance is disabled, we only consider direct tags, ;; When tag inheritance is disabled, we only consider direct tags,
;; so we can search directly to headings containing one of the tags. ;; so we can search directly to headings containing one of the tags.