Why is threadpool for core.async in clojure created with a fixed pool of threads from # cores from 2 to 42?

The threadpool implementation in the core.async clojure library uses a FixedThreadPoolExecutor of size = # from kernels * 2 + 42.

(defonce the-executor (Executors/newFixedThreadPool (-> (Runtime/getRuntime) (.availableProcessors) (* 2) (+ 42)) (conc/counted-thread-factory "async-dispatch-%d" true))) 

Is there any reason to use these numbers (in particular, the number of cores 2 plus 42)? Is this optimal for all devices? I just want to know how rich hickeys (and participants) settled with these numbers.


Thanks, nullptr.

Here is a discussion for those interested: http://clojure-log.n01se.net/date/2013-08-29.html#15:45a

+5
source share
1 answer

Some discussion on the link below, but this is mostly arbitrary.

https://groups.google.com/d/msg/clojure/mT-r3EDeC74/dvaFqHnAZxgJ

+1
source

Source: https://habr.com/ru/post/1204938/


All Articles