emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/dict-tree 8d8ce4f 120/154: Print dict-tree cache sizes


From: Stefan Monnier
Subject: [elpa] externals/dict-tree 8d8ce4f 120/154: Print dict-tree cache sizes in edebug.
Date: Mon, 14 Dec 2020 12:21:58 -0500 (EST)

branch: externals/dict-tree
commit 8d8ce4f33766e38c0dae9d39fe5e73b92ac16a46
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>

    Print dict-tree cache sizes in edebug.
---
 dict-tree.el | 46 ++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/dict-tree.el b/dict-tree.el
index c040c22..5668ff3 100644
--- a/dict-tree.el
+++ b/dict-tree.el
@@ -52,6 +52,10 @@
 ;; according to any other desired ranking. The results can also be limited to
 ;; a given number of matches.
 ;;
+;; These sophisticated string queries are fast even for very large dict-trees,
+;; and dict-tree's also cache query results (and automatically keep these
+;; caches synchronised) to speed up queries even further.
+;;
 ;; Other functions allow you to:
 ;;
 ;; - create dict-tree stack objects, which allow efficient access to the
@@ -63,9 +67,12 @@
 ;; - map over all strings in alphabetical order
 ;;   (`dictree-mapc', `dictree-mapcar' and `dictree-mapf')
 ;;
-;; These sophisticated string queries are fast even for very large dict-trees,
-;; and dict-tree's also cache query results (and automatically keep these
-;; caches synchronised) to speed up queries even further.
+;; Dict-trees can be combined together into a "meta dict-tree", which combines
+;; the data from identical keys in its constituent dict-trees, in whatever way
+;; you specify (`dictree-create-meta-dict'). Any number of dict-trees can be
+;; combined in this way. Meta-dicts behave *exactly* like dict-trees: all of
+;; the above functions work on meta-dicts as well as dict-trees, and
+;; meta-dicts can themselves be used in new meta-dicts.
 ;;
 ;; The package also provides persistent storage of dict-trees to file.
 ;; (`dictree-save', `dictree-write', `dictee-load')
@@ -3782,7 +3789,38 @@ extension, suitable for passing to `load-library'."
 (defun dictree--edebug-pretty-print (object)
   (cond
    ((dictree-p object)
-    (concat "#<dict-tree \"" (dictree-name object) "\">"))
+    (concat "#<dict-tree \"" (dictree-name object) "\""
+           (if (dictree--lookup-cache object)
+               (concat " lookup "
+                       (prin1-to-string
+                        (hash-table-count
+                         (dictree--lookup-cache object))))
+             "")
+           (if (dictree--complete-cache object)
+               (concat " complete "
+                       (prin1-to-string
+                        (hash-table-count
+                         (dictree--complete-cache object))))
+             "")
+           (if (dictree--regexp-cache object)
+               (concat " regexp "
+                       (prin1-to-string
+                        (hash-table-count
+                         (dictree--regexp-cache object))))
+             "")
+           (if (dictree--fuzzy-match-cache object)
+               (concat " fuzzy-match "
+                       (prin1-to-string
+                        (hash-table-count
+                         (dictree--fuzzy-match-cache object))))
+             "")
+           (if (dictree--fuzzy-complete-cache object)
+               (concat " fuzzy-complete "
+                       (prin1-to-string
+                        (hash-table-count
+                         (dictree--fuzzy-complete-cache object))))
+             "")
+           ">"))
    ((null object) "nil")
    ((let ((dlist object) (test t))
       (while (or (dictree-p (car-safe dlist))



reply via email to

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