This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-22
Channels
- # announcements (2)
- # aws (5)
- # babashka (17)
- # beginners (108)
- # calva (28)
- # chlorine-clover (7)
- # clj-kondo (14)
- # cljs-dev (9)
- # cljsrn (2)
- # clojure (118)
- # clojure-europe (50)
- # clojure-finland (5)
- # clojure-france (15)
- # clojure-italy (9)
- # clojure-nl (14)
- # clojure-spec (11)
- # clojure-uk (43)
- # clojuredesign-podcast (1)
- # clojurescript (35)
- # clojutre (2)
- # clr (3)
- # community-development (6)
- # conjure (9)
- # core-async (41)
- # cursive (7)
- # data-science (7)
- # datomic (11)
- # events (1)
- # figwheel-main (4)
- # fulcro (20)
- # ghostwheel (9)
- # graalvm (18)
- # helix (46)
- # leiningen (14)
- # observability (2)
- # off-topic (23)
- # pathom (4)
- # re-frame (5)
- # reitit (5)
- # rum (2)
- # shadow-cljs (32)
- # spacemacs (8)
- # specter (5)
- # sql (36)
- # timbre (3)
- # vim (15)
- # xtdb (2)
- # yada (2)
(defn chan
([size]
(ArrayBlockingQueue. size))
([]
(chan 1)))
(defn >! [chan val]
(.put chan val))
(defn <! [chan]
(.take chan))
(defmacro go [& code]
`(with-open [scope# (FiberScope/open (into-array FiberScope$Option []))]
(let [c# (chan)]
(.schedule scope# (reify Callable
(call [_]
(>! c# (do ~@code)))))
c#)))
They're getting rid of all the Fiber stuff and doing Loom via (virtual) Threads now so it'll all be "just like threads" except lightweight and you won't need to pool etc.
(and targeting Java 17 for them... so it's still "years away")
i was wondering why there wasn't a Fiber class when i downloaded the last preview build
This has some nice examples and timings https://medium.com/@alexey.soshin/project-loom-virtual-threads-in-java-371dccc88b0f
java 17 is actually only like a year away at current schedule (at least for early builds)
15 eas are out now
loom builds are based on that
Yeah, I saw the new virtual threads stuff is available in 15ea. I was thinking of 17ga tho' since many folks wouldn't want to run non-LTS, non-GA builds in production. Looking at the schedule for 15ga, I guess 17ga would be September 2021 so it's only 18 months away right now...
I will temper my enthusiasm with my decade of waiting for it to appear
I've been able to crash these early release jdks pretty easy with write contention on atoms
(defn chan
([size]
(ArrayBlockingQueue. size))
([]
(chan 1)))
(defn >! [chan val]
(.put chan val))
(defn <! [chan]
(.take chan))
(defmacro go [& code]
`(let [c# (chan)]
(Thread/startVirtualThread
(fn [] (>! c# (do ~@code))))
c#))
Hmm, what would the performance difference be between core.async chans and the java BlockingQueues
Unlike a BlockingQueue core.async channels are designed to work with go blocks and do not block threads but instead have parking semantics.