This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-24
Channels
- # admin-announcements (1)
- # aleph (3)
- # announcements (4)
- # beginners (30)
- # boot (296)
- # cider (21)
- # cljsjs (2)
- # cljsrn (18)
- # clojure (124)
- # clojure-poland (23)
- # clojure-russia (4)
- # clojurescript (73)
- # core-async (58)
- # css (3)
- # datomic (31)
- # editors (4)
- # emacs (35)
- # euroclojure (3)
- # hoplon (104)
- # immutant (8)
- # jobs (3)
- # jobs-discuss (1)
- # keechma (1)
- # ldnclj (33)
- # leiningen (5)
- # liberator (1)
- # mount (20)
- # off-topic (2)
- # om (104)
- # onyx (54)
- # parinfer (80)
- # proton (1)
- # re-frame (59)
- # remote-jobs (1)
- # ring-swagger (9)
- # slack-help (15)
- # spacemacs (7)
- # yada (12)
@ericfode can you show me the value of media-type?
@mccraigmccraig: in this case order doesn't matter indeed, so the callbacks that put onto a stream would work.
I think if you want to preserve order and want to control the parallelism on a stream you'd need to implement something like https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L470
(defn get-stuff
[x]
(d/future
(println (str "Getting " x))
(Thread/sleep 1000)
(inc x)))
(def executor (executor/fixed-thread-executor 1))
(time (->> (stream/->source (range 20))
(stream/onto executor)
(stream/map get-stuff)
(stream/map deref)
(stream/consume println)))
=> Getting 0
Getting 1
1Getting 2
Getting 3
2
3
Getting 4
Getting 5
4
5
Getting 6
Getting 7
...
"Elapsed time: 10042.600795 msecs"
if the executor is a fixed-thread-executor 20, same result. it always takes 2 at a time.
as I understand it from the docs: > execute-pool - Used to execute manifold.deferred/future bodies, and only created if that macro is used. This is an instrumented pool, and statistics can be consumed via manifold.executor/register-execute-pool-stats-callback.
I would think that increasing the number of threads would increase the number of futures being evaluated
Really? I'm glad you worked it out.
Sorry for the delay in responding, work priorities got in the way