Skip to content

Commit 9dc1b38

Browse files
authored
Remove unnecessary binding of current message (#736)
The binding is not used within the body expressions, and costs a thread local binding, producing garbage. This changes ensures print-stream produces no memory garbage. The forking-printer just takes values and forwards them. There is no execution of user code, so it can not possibly use the message in any. print-stream invokes the forking printer flush every 100ms, so the current code produces garbage every 100ms.
1 parent df6b5c6 commit 9dc1b38

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/cider/nrepl/middleware/out.clj

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
guarantee that the channel that sent the clone message will properly
1111
handle output replies."
1212
(:require
13-
[cider.nrepl.middleware.util.error-handling :refer [with-safe-transport]]
14-
[nrepl.middleware.interruptible-eval :as ieval])
13+
[cider.nrepl.middleware.util.error-handling :refer [with-safe-transport]])
1514
(:import
1615
[java.io PrintWriter Writer PrintStream OutputStream]
1716
[java.util TimerTask Timer]))
@@ -34,11 +33,11 @@ Please do not inline; they must not be recomputed at runtime."}
3433
(case ~type
3534
:out #'*out*
3635
:err #'*err*))]
37-
(try (binding [ieval/*msg* ~'msg]
38-
~@body)
39-
;; If a channel is faulty, dissoc it.
40-
(catch Exception ~'e
41-
(unsubscribe-session ~'session))))))
36+
(try
37+
~@body
38+
;; If a channel is faulty, dissoc it.
39+
(catch Exception ~'e
40+
(unsubscribe-session ~'session))))))
4241

4342
(defn- dispatch-string
4443
([messages type ^String x]

0 commit comments

Comments
 (0)