Created
March 26, 2011 21:12
-
-
Save swannodette/888637 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns subcont.core | |
(:import [java.util.concurrent RecursiveTask])) | |
(set! *warn-on-reflection* true) | |
(defn ^RecursiveTask recursive-task [f] | |
(proxy [RecursiveTask] [] | |
(compute [] (f)))) | |
(def ^RecursiveTask t (recursive-task (fn [] :foo))) | |
(.compute ^RecursiveTask t) ;; reflection here :( | |
(comment | |
(dotimes [_ 10] | |
(let [^RecursiveTask t (recursive-task (fn [] 'foo))] | |
(time | |
(dotimes [_ 1e6] | |
(.compute t))))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment