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

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

[elpa] externals/phps-mode d76ba9f39f 22/29: Optimized cache storage siz


From: Christian Johansson
Subject: [elpa] externals/phps-mode d76ba9f39f 22/29: Optimized cache storage size
Date: Thu, 15 Feb 2024 03:14:37 -0500 (EST)

branch: externals/phps-mode
commit d76ba9f39f8e4ea8a0546417517edc4f0a76f915
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Optimized cache storage size
---
 phps-mode-lex-analyzer.el    | 20 ++++++++++++++++----
 phps-mode-lexer-generator.el | 17 +----------------
 phps-mode-lexer.el           | 11 +++--------
 3 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index ff236313c1..65ec472a84 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -257,7 +257,8 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
                        (phps-mode-lex-analyzer--set-region-syntax-color
                         start
                         end
-                        (list 'font-lock-face token-syntax-color)))))))
+                        (list 'font-lock-face token-syntax-color))))))
+               (thread-yield))
 
              (let ((current-time (current-time)))
                (setq
@@ -993,7 +994,12 @@ of performed operations.  Optionally do it 
FORCE-SYNCHRONOUS."
              cache-value)))))
 
     (if loaded-from-cache
-        loaded-from-cache
+        (progn
+          (phps-mode-debug-message
+           (message
+            "Loaded from file-system cache: %S"
+            loaded-from-cache))
+          loaded-from-cache)
       (let* ((buffer (generate-new-buffer "*PHPs Parser*"))
              (cache)
              (tokens)
@@ -1003,6 +1009,10 @@ of performed operations.  Optionally do it 
FORCE-SYNCHRONOUS."
              (bookkeeping)
              (imenu)
              (symbol-table))
+        (phps-mode-debug-message
+         (message
+          "Did not load from file-system cache-key: %S"
+          cache-key))
 
         ;; Create temporary buffer and run lexer in it
         (when (get-buffer buffer)
@@ -1075,10 +1085,12 @@ of performed operations.  Optionally do it 
FORCE-SYNCHRONOUS."
                  allow-cache-write
                  cache-key)
             (phps-mode-debug-message
-             (message "Saved to cache"))
+             (message "Saving cache..."))
             (phps-mode-cache-save
              data
-             cache-key))
+             cache-key)
+            (phps-mode-debug-message
+             (message "Saved to cache")))
 
           data)))))
 
diff --git a/phps-mode-lexer-generator.el b/phps-mode-lexer-generator.el
index fe136f54f3..d7eff3494a 100644
--- a/phps-mode-lexer-generator.el
+++ b/phps-mode-lexer-generator.el
@@ -28,9 +28,6 @@
 (defvar-local phps-mode-lexer--state-stack nil
   "Current state-stack of lexer.")
 
-(defvar-local phps-mode-lexer--states nil
-  "History of state and state-stack.")
-
 (defvar-local phps-mode-lexer--heredoc-label nil
   "Current heredoc label.")
 
@@ -2044,19 +2041,7 @@
     (buffer-substring-no-properties
      start
      end)
-    `(,token ,start . ,end)))
-  
-  ;; Push token start, end, lexer state and state stack to variable
-  (push
-   (list
-    start
-    end
-    phps-mode-lexer--state
-    phps-mode-lexer--state-stack
-    phps-mode-lexer--heredoc-label
-    phps-mode-lexer--heredoc-label-stack
-    phps-mode-lexer--nest-location-stack)
-   phps-mode-lexer--states))
+    `(,token ,start . ,end))))
 
 (defun phps-mode-lexer--get-next-unescaped (character)
   "Find where next un-escaped CHARACTER comes, if none is found return nil."
diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index dfd2b3a48d..e41ba52829 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -92,19 +92,15 @@
           ;; Set state here
           (let ((old-state-state (nth 0 old-state))
                 (old-state-stack (nth 1 old-state))
-                (old-state-states (nth 2 old-state))
-                (old-state-heredoc-label (nth 3 old-state))
-                (old-state-heredoc-label-stack (nth 4 old-state))
-                (old-state-nest-location-stack (nth 5 old-state)))
+                (old-state-heredoc-label (nth 2 old-state))
+                (old-state-heredoc-label-stack (nth 3 old-state))
+                (old-state-nest-location-stack (nth 4 old-state)))
             (setq
              phps-mode-lexer--state
              old-state-state)
             (setq
              phps-mode-lexer--state-stack
              old-state-stack)
-            (setq
-             phps-mode-lexer--states
-             old-state-states)
             (setq
              phps-mode-lexer--heredoc-label
              old-state-heredoc-label)
@@ -232,7 +228,6 @@
              (list
               phps-mode-lexer--state
               phps-mode-lexer--state-stack
-              phps-mode-lexer--states
               phps-mode-lexer--heredoc-label
               phps-mode-lexer--heredoc-label-stack
               phps-mode-lexer--nest-location-stack))



reply via email to

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