Add parser benchmark
ci/woodpecker/push/woodpecker Pipeline was successful Details

WIP-incremental-parsing
Hugo Thunnissen 10 months ago
parent 0f24f7577f
commit 8e612d76e5

File diff suppressed because it is too large Load Diff

@ -0,0 +1,23 @@
(require 'phpinspect)
(let ((here (file-name-directory (or load-file-name buffer-file-name))))
(with-temp-buffer
(setq-local phpinspect-current-buffer (phpinspect-make-buffer :buffer (current-buffer)))
(insert-file-contents (concat here "/Response.php"))
(message "Metadata parse:")
(benchmark 1 '(phpinspect-buffer-parse phpinspect-current-buffer))
(message "Bare parse:")
(benchmark 1 '(phpinspect-parse-current-buffer))
(goto-char (floor (/ (point-max) 2 )))
(insert "abc")
(phpinspect-buffer-register-edit phpinspect-current-buffer (- (point) 3) (point) 0)
(message "Metadata parse incremental:")
(benchmark 1 '(phpinspect-buffer-parse phpinspect-current-buffer))))

@ -593,7 +593,6 @@ parsing. Usually used in combination with
(current-end-position)
(token))
(unless (not previous-tree)
(message "Searching for existing node at point %d" (point))
(setq existing-node (phpinspect-pctx-find-existing-node-at-point
context original-position))
(when existing-node
@ -610,8 +609,8 @@ parsing. Usually used in combination with
;; Alter regions to current token position in buffer
(let ((delta (- start-position original-position)))
(unless (= 0 delta)
(message "Shifting tree with delta %d" delta)
(message "point: %d, start position: %d" (point) start-position)
;; (message "Shifting tree with delta %d" delta)
;; (message "point: %d, start position: %d" (point) start-position)
(phpinspect-tree-shift existing-node delta)))
(goto-char current-end-position)

Loading…
Cancel
Save