summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2015-09-10 04:22:10 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2015-09-10 04:22:10 +0200
commit0db9d5c26a82ee5f318655719ceb7d4bea8f74a7 (patch)
treed87a5b3de8e9d2749f6b949cad8c008d2946af9f
parent4c9dddb1a668a7a5cbac217c45558ad5e419cc9d (diff)
downloadgeiser-0db9d5c26a82ee5f318655719ceb7d4bea8f74a7.tar.gz
geiser-0db9d5c26a82ee5f318655719ceb7d4bea8f74a7.tar.bz2
Speeding up debugger check (addresses #64)
Soooo, the long delay experienced when evaluating long string lists in Guile had nothing to do with the time took by emacs to read the response from the scheme process; that process is always a breeze, no matter or its format or number of newlines. The delay was provoked by an innocent looking function that scans the received string (which includes a prompt at the end as an EOT marker) to check whether Guile (or any other scheme) has just entered the debugger (that's done inside `geiser-con--connection-update-debugging`). For some reason, `string-match` on that kind of string using Guile's regexp for a debug prompt takes forever. Instead of trying to optimize the regular expression, i've just applied it to the *second* line of the received string, which is the one that contains the response's prompt.
-rw-r--r--elisp/geiser-connection.el14
1 files changed, 6 insertions, 8 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index 69dd6a9..e466cd3 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -156,7 +156,8 @@
(defun geiser-con--has-entered-debugger (con answer)
(and (not (geiser-con--connection-is-debugging con))
- (geiser-con--connection-update-debugging con answer)))
+ (let ((p (car (last (split-string answer "\n" t)))))
+ (and p (geiser-con--connection-update-debugging con p)))))
(defun geiser-con--connection-eot-p (con txt)
(and txt
@@ -201,15 +202,12 @@
`((error (key . geiser-debugger))
(output . ,answer))
(condition-case err
- (let* ((start (string-match "((\\(?:result)?\\|error\\) " answer))
- (form (or (and start (car (read-from-string answer start)))
- `((error (key . retort-syntax))
- (output . ,answer)))))
- form)
+ (let ((start (string-match "((\\(?:result)?\\|error\\) " answer)))
+ (or (and start (car (read-from-string answer start)))
+ `((error (key . retort-syntax)) (output . ,answer))))
(error `((error (key . geiser-con-error))
(output . ,(format "%s\n(%s)"
- answer
- (error-message-string err)))))))))
+ answer (error-message-string err)))))))))
(defun geiser-con--process-completed-request (req answer)
(let ((cont (geiser-con--request-continuation req))