为什么clojure中的core.async的线程池是使用固定线程池的#核心次数加2加42创建的?

wil*_*nux 6 clojure core.async

线程池实现在core.async Clojure的库使用尺寸=芯*2 + 42#的FixedThreadPoolExecutor.

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

是否有理由使用这些数字(核心数乘以2加42)?这对所有设备都是最佳的吗?我只是想知道丰富的hickey(和贡献者)如何用这些数字来解决.


谢谢nullptr.

以下是对有兴趣的人的讨论:http://clojure-log.n01se.net/date/2013-08-29.html#15 : 45a

Der*_*ger 2

下面的链接有一些讨论,但基本上是任意的。

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