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

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

[elpa] externals/org 0350c7d 2/3: org.el: Avoid excessive memory usage b


From: ELPA Syncer
Subject: [elpa] externals/org 0350c7d 2/3: org.el: Avoid excessive memory usage by effort text properties
Date: Fri, 10 Dec 2021 21:57:33 -0500 (EST)

branch: externals/org
commit 0350c7dd71ed137940eb01aca6956f26d81fbac2
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org.el: Avoid excessive memory usage by effort text properties
    
    * lisp/org.el (org-set-effort):
    (org-property-next-allowed-value): Do not use text properties cache
    for `effort' and `effort-minutes' when org-element-cache is active.
    These text properties are superceded by element cache and their only
    effect (when cache is active) is extra load on Emacs garbage collector
    leading to overall Emacs slowdown.
    * lisp/org-clock.el (org-clock-in): Use `org-element-use-cache'
    instead of `org-element--cache-active-p' to check if element cache is
    active. The latter is too precise and may trigger
    `org-refresh-effort-properties' when cache is temporarily disabled by
    internal calls.
---
 lisp/org-clock.el |  3 ++-
 lisp/org.el       | 18 ++++++++++--------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 1ac680b..e6c7568 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -36,6 +36,7 @@
 (declare-function org-element-property "org-element" (property element))
 (declare-function org-element-type "org-element" (element))
 (declare-function org-element--cache-active-p "org-element" ())
+(defvar org-element-use-cache)
 (declare-function org-inlinetask-at-task-p "org-inlinetask" ())
 (declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
 (declare-function org-inlinetask-goto-end "org-inlinetask" ())
@@ -1266,7 +1267,7 @@ time as the start time.  See `org-clock-continuously' to 
make this
 the default behavior."
   (interactive "P")
   (setq org-clock-notification-was-shown nil)
-  (unless (org-element--cache-active-p)
+  (unless org-element-use-cache
     (org-refresh-effort-properties))
   (catch 'abort
     (let ((interrupting (and (not org-clock-resolving-clocks-due-to-idleness)
diff --git a/lisp/org.el b/lisp/org.el
index 7ff8574..2962034 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12965,9 +12965,10 @@ variables is set."
     ;; Maybe update the effort value:
     (unless (equal current value)
       (org-entry-put nil org-effort-property value))
-    (org-refresh-property '((effort . identity)
-                           (effort-minutes . org-duration-to-minutes))
-                         value)
+    (unless (org-element--cache-active-p)
+      (org-refresh-property '((effort . identity)
+                          (effort-minutes . org-duration-to-minutes))
+                        value))
     (when (equal (org-get-heading t t t t)
                 (bound-and-true-p org-clock-current-task))
       (setq org-clock-effort value)
@@ -13915,10 +13916,11 @@ completion."
     (beginning-of-line 1)
     (skip-chars-forward " \t")
     (when (equal prop org-effort-property)
-      (org-refresh-property
-       '((effort . identity)
-        (effort-minutes . org-duration-to-minutes))
-       nval)
+      (unless (org-element--cache-active-p)
+        (org-refresh-property
+         '((effort . identity)
+          (effort-minutes . org-duration-to-minutes))
+         nval))
       (when (string= org-clock-current-task heading)
        (setq org-clock-effort nval)
        (org-clock-update-mode-line)))
@@ -15907,7 +15909,7 @@ When a buffer is unmodified, it is just killed.  When 
modified, it is saved
            (or (memq 'stats org-agenda-ignore-properties)
                (org-refresh-stats-properties))
            (or (memq 'effort org-agenda-ignore-properties)
-                (unless (org-element--cache-active-p)
+                (unless org-element-use-cache
                  (org-refresh-effort-properties)))
            (or (memq 'appt org-agenda-ignore-properties)
                (org-refresh-properties "APPT_WARNTIME" 'org-appt-warntime))



reply via email to

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