[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode f6004f1b37 04/12: Added profiling outputs
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode f6004f1b37 04/12: Added profiling outputs |
Date: |
Sun, 5 Feb 2023 03:06:13 -0500 (EST) |
branch: externals/phps-mode
commit f6004f1b3707f8c927c97fefc50e5b0c069237ec
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added profiling outputs
---
phps-mode-lex-analyzer.el | 190 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 180 insertions(+), 10 deletions(-)
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 737265a5c5..871fd2863e 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -223,14 +223,30 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
(async (and (boundp 'phps-mode-async-process)
phps-mode-async-process))
(async-by-process (and (boundp 'phps-mode-async-process-using-async-el)
- phps-mode-async-process-using-async-el)))
+ phps-mode-async-process-using-async-el))
+ (timer-start)
+ (timer-elapsed-lexer)
+ (timer-elapsed-parser)
+ (timer-start-syntax-coloring)
+ (timer-finished-syntax-coloring)
+ (timer-elapsed-syntax-coloring)
+ (timer-elapsed)
+ (timer-end))
(when force-synchronous
(setq async nil))
+ (let ((current-time (current-time)))
+ (setq
+ timer-start
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001))))
(phps-mode-serial-commands
buffer-name
+ ;; Potentially asynchronous thread
(lambda()
(phps-mode-lex-analyzer--lex-string
buffer-contents
@@ -247,6 +263,7 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
allow-cache-read
allow-cache-write))
+ ;; Main thread - successful operation
(lambda(lex-result)
(when (get-buffer buffer-name)
(with-current-buffer buffer-name
@@ -265,10 +282,20 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
(setq phps-mode-lex-analyzer--bookkeeping (nth 10 lex-result))
(setq phps-mode-lex-analyzer--imenu (nth 11 lex-result))
(setq phps-mode-lex-analyzer--symbol-table (nth 12 lex-result))
+ (setq timer-elapsed-lexer (nth 13 lex-result))
+ (setq timer-elapsed-parser (nth 14 lex-result))
(setq phps-mode-lex-analyzer--processed-buffer-p t)
(phps-mode-lex-analyzer--reset-imenu)
+ (let ((current-time (current-time)))
+ (setq
+ timer-start-syntax-coloring
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001))))
+
;; Apply syntax color
(phps-mode-lex-analyzer--clear-region-syntax-color
(point-min)
@@ -284,6 +311,19 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
end
(list 'font-lock-face token-syntax-color))))))
+ (let ((current-time (current-time)))
+ (setq
+ timer-finished-syntax-coloring
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001)))
+ (setq
+ timer-elapsed-syntax-coloring
+ (-
+ timer-finished-syntax-coloring
+ timer-start-syntax-coloring)))
+
;; Reset buffer changes minimum index
(phps-mode-lex-analyzer--reset-changes)
@@ -312,8 +352,29 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
;; Reset error
(setq phps-mode-lex-analyzer--error-end nil)
(setq phps-mode-lex-analyzer--error-message nil)
- (setq phps-mode-lex-analyzer--error-start nil)))))
-
+ (setq phps-mode-lex-analyzer--error-start nil))))
+
+ (let ((current-time (current-time)))
+ (setq
+ timer-end
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001)))
+ (setq
+ timer-elapsed
+ (-
+ timer-end
+ timer-start)))
+
+ (message "Total elapsed time: %S" timer-elapsed)
+ (message "Lexer elapsed time: %S" timer-elapsed-lexer)
+ (message "Parser elapsed time: %S" timer-elapsed-parser)
+ (message "Syntax coloring elapsed time: %S"
timer-elapsed-syntax-coloring)
+
+ )
+
+ ;; Main thread - error handling
(lambda(result)
(when (get-buffer buffer-name)
(with-current-buffer buffer-name
@@ -364,17 +425,33 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
(buffer-name buffer-contents incremental-start-new-buffer point-max
head-states incremental-state incremental-state-stack
incremental-heredoc-label incremental-heredoc-label-stack
incremental-nest-location-stack head-tokens &optional force-synchronous
filename allow-cache-write)
"Incremental lex region."
- (let ((async (and (boundp 'phps-mode-async-process)
+ (let* ((async (and (boundp 'phps-mode-async-process)
phps-mode-async-process))
(async-by-process (and (boundp 'phps-mode-async-process-using-async-el)
- phps-mode-async-process-using-async-el)))
+ phps-mode-async-process-using-async-el))
+ (timer-start)
+ (timer-elapsed-lexer)
+ (timer-elapsed-parser)
+ (timer-start-syntax-coloring)
+ (timer-finished-syntax-coloring)
+ (timer-elapsed-syntax-coloring)
+ (timer-elapsed)
+ (timer-end))
(when force-synchronous
(setq async nil))
+ (let ((current-time (current-time)))
+ (setq
+ timer-start
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001))))
(phps-mode-serial-commands
buffer-name
+ ;; Potentially asynchronous thread
(lambda()
(phps-mode-lex-analyzer--lex-string
buffer-contents
@@ -391,6 +468,7 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
nil
allow-cache-write))
+ ;; Main thread - successful operation
(lambda(lex-result)
(when (get-buffer buffer-name)
(with-current-buffer buffer-name
@@ -411,6 +489,8 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
(setq phps-mode-lex-analyzer--bookkeeping (nth 10 lex-result))
(setq phps-mode-lex-analyzer--imenu (nth 11 lex-result))
(setq phps-mode-lex-analyzer--symbol-table (nth 12 lex-result))
+ (setq timer-elapsed-lexer (nth 13 lex-result))
+ (setq timer-elapsed-parser (nth 14 lex-result))
(phps-mode-debug-message
(message
@@ -421,6 +501,14 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
(setq phps-mode-lex-analyzer--processed-buffer-p t)
(phps-mode-lex-analyzer--reset-imenu)
+ (let ((current-time (current-time)))
+ (setq
+ timer-start-syntax-coloring
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001))))
+
;; Apply syntax color on tokens
(phps-mode-lex-analyzer--clear-region-syntax-color
incremental-start-new-buffer
@@ -434,6 +522,19 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
(when token-syntax-color
(phps-mode-lex-analyzer--set-region-syntax-color start
end (list 'font-lock-face token-syntax-color))))))
+ (let ((current-time (current-time)))
+ (setq
+ timer-finished-syntax-coloring
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001)))
+ (setq
+ timer-elapsed-syntax-coloring
+ (-
+ timer-finished-syntax-coloring
+ timer-start-syntax-coloring)))
+
;; Reset buffer changes minimum index
(phps-mode-lex-analyzer--reset-changes)
@@ -462,8 +563,29 @@ ALLOW-CACHE-READ and ALLOW-CACHE-WRITE."
;; Reset error
(setq phps-mode-lex-analyzer--error-end nil)
(setq phps-mode-lex-analyzer--error-message nil)
- (setq phps-mode-lex-analyzer--error-start nil)))))
-
+ (setq phps-mode-lex-analyzer--error-start nil))))
+
+ (let ((current-time (current-time)))
+ (setq
+ timer-end
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001)))
+ (setq
+ timer-elapsed
+ (-
+ timer-end
+ timer-start)))
+
+ (message "Total elapsed time: %S" timer-elapsed)
+ (message "Lexer elapsed time: %S" timer-elapsed-lexer)
+ (message "Parser elapsed time: %S" timer-elapsed-parser)
+ (message "Syntax coloring elapsed time: %S"
timer-elapsed-syntax-coloring)
+
+ )
+
+ ;; Main thread - error handling
(lambda(result)
(when (get-buffer buffer-name)
(with-current-buffer buffer-name
@@ -1128,8 +1250,24 @@ of performed operations. Optionally do it
FORCE-SYNCHRONOUS."
;; to enable nice presentation
(require 'phps-mode-macros)
- (let ((loaded-from-cache)
- (cache-key))
+ (let* ((loaded-from-cache)
+ (cache-key)
+ (timer-start-lexer)
+ (timer-finished-lexer)
+ (timer-elapsed-lexer)
+ (timer-start-parser)
+ (timer-finished-parser)
+ (timer-elapsed-parser))
+
+ (let* ((current-time (current-time))
+ (start-time
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001))))
+ (setq
+ timer-start-lexer
+ start-time))
;; Build cache key if possible
(when (and
@@ -1231,6 +1369,22 @@ of performed operations. Optionally do it
FORCE-SYNCHRONOUS."
(setq heredoc-label-stack phps-mode-lexer--heredoc-label-stack)
(setq nest-location-stack phps-mode-lexer--nest-location-stack)
+ (let* ((current-time (current-time))
+ (end-time
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001))))
+ (setq
+ timer-finished-lexer
+ end-time)
+ (setq
+ timer-start-parser
+ end-time)
+ (setq
+ timer-elapsed-lexer
+ (- timer-finished-lexer timer-start-lexer)))
+
;; Error-free parse here
(condition-case conditions
(progn
@@ -1247,6 +1401,20 @@ of performed operations. Optionally do it
FORCE-SYNCHRONOUS."
(setq imenu phps-mode-parser-sdt-symbol-imenu)
(setq symbol-table phps-mode-parser-sdt-symbol-table)
+ (let* ((current-time
+ (current-time))
+ (end-time
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001))))
+ (setq
+ timer-finished-parser
+ end-time)
+ (setq
+ timer-elapsed-parser
+ (- timer-finished-parser timer-start-parser)))
+
(kill-buffer)))
(let ((data
@@ -1263,7 +1431,9 @@ of performed operations. Optionally do it
FORCE-SYNCHRONOUS."
ast-tree
bookkeeping
imenu
- symbol-table)))
+ symbol-table
+ timer-elapsed-lexer
+ timer-elapsed-parser)))
;; Save cache if possible and permitted
(when (and
- [elpa] externals/phps-mode updated (a1aaad619a -> f13607bf1e), Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode d4832bfb92 05/12: Added flag to control display of profiling information, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode ee28b83099 01/12: Added support for bookkeeping and imenu for list() variable assignment, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode f6004f1b37 04/12: Added profiling outputs,
Christian Johansson <=
- [elpa] externals/phps-mode 8f0b9459c4 07/12: More work on bookkeeping constants, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 1e659967a8 08/12: More work on constants bookkeeping, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 8a3492da41 09/12: Improved bookkeeping of referenced variable, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 541111abf7 03/12: More work on bookkeeping class constants, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode f13607bf1e 12/12: Updated version to 0.4.34, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 7c2b17a4b6 06/12: Added new todo items, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode a034b63d56 02/12: Started on bookkeeping global constants, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode a9241a9b67 10/12: Added constants bookkeeping and imenu test again, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 7f504111eb 11/12: Commented out work on bookkeeping constants, Christian Johansson, 2023/02/05