Permalink
Browse files

add a couple of type hints for performance enhancement

- type hint on slurp-into was essential to avoid 10x slowdown
  • Loading branch information...
1 parent 10b79be commit af2bbf85a8274014c500a7a6831e59c99c2888e4 @jxa jxa committed Mar 20, 2012
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/dieter/rhino.clj
  2. +2 −2 src/dieter/util.clj
View
2 src/dieter/rhino.clj
@@ -63,7 +63,7 @@
(defn call [fn-name & args]
- (let [fun (.get scope fn-name scope)]
+ (let [#^org.mozilla.javascript.InterpretedFunction fun (.get scope fn-name scope)]
(.call fun context scope nil (into-array args))))
(defn getvar
View
4 src/dieter/util.clj
@@ -1,9 +1,9 @@
(ns dieter.util
(:require [clojure.java.io :as io]))
-(defn slurp-into [builder f]
+(defn slurp-into [#^StringBuilder builder f]
"read file contents into an existing string builder"
- (with-open [r (io/reader f)]
+ (with-open [#^java.io.Reader r (io/reader f)]
(loop [c (.read r)]
(if (neg? c)
builder

0 comments on commit af2bbf8

Please sign in to comment.