Skip to content

Commit

Permalink
Fixed lag in safe-io plotting by using buffered input, plotting is
Browse files Browse the repository at this point in the history
much faster now
  • Loading branch information
ghollisjr committed Mar 1, 2016
1 parent 8754846 commit 79fb696
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 46 deletions.
27 changes: 2 additions & 25 deletions gnuplot-interface/gnuplot-interface.lisp
Expand Up @@ -21,36 +21,13 @@

(in-package :cl-ana.gnuplot-interface)

;; (defun gnuplot-init ()
;; (let ((session
;; (start "script"
;; (list "-c" "/bin/sh" "-q" "/dev/null")
;; :input :stream
;; :output :stream
;; :error :stream
;; :external-format :utf-8)))
;; (format (process-input-stream session)
;; "gnuplot~%")
;; (finish-output (process-input-stream session))
;; session))

;; (defun gnuplot-init ()
;; (let ((session
;; (start "gnuplot"
;; ()
;; :input :stream
;; :output :stream
;; :error :stream
;; :external-format :utf-8)))
;; session))

(defun gnuplot-init ()
(let ((session
(start "/home/ghollisjr/gnuplot.sh"
(start "gnuplot"
()
:input :stream
:output :stream
:error :stream
:error :output
:external-format :utf-8)))
session))

Expand Down
24 changes: 3 additions & 21 deletions plotting/plotting.lisp
Expand Up @@ -409,27 +409,9 @@ layout specified in the page.")
p
;; Use NIL for no special treatment, or *gnuplot-safe-io* for
;; special waiting
(if *gnuplot-safe-io*
(let* ((lines
(split-sequence:split-sequence #\Newline
(generate-cmd p)))
(groups
(group lines *gnuplot-safe-io-nlines*)))
(loop
for group in groups
do
(loop
for line in group
do
(gnuplot-cmd session line))
(prompt-wait-by session
(lambda (x)
(or (matches x "gnuplot> ")
(matches x "multiplot> ")))
:duration-min 0.0001)))
(progn
(gnuplot-cmd session (generate-cmd p))
(prompt-wait session "gnuplot> "))))))
(gnuplot-cmd session (generate-cmd p))
;; (prompt-wait session (format nil "gnuplot> ~%"))
(prompt-wait session (format nil "gnuplot> ~%")))))

(defmethod initialize-instance :after
((p page) &key)
Expand Down

0 comments on commit 79fb696

Please sign in to comment.