How long does it take to create 1 million threads in Haskell?

后端 未结 4 1096
栀梦
栀梦 2021-01-31 21:55

What I understand, Haskell have green threads. But how light weight are they. Is it possible to create 1 million threads?

Or How long would it take for 100 000 threads?

4条回答
  •  感情败类
    2021-01-31 22:05

    Using the benchmark here, http://www.reddit.com/r/programming/comments/a4n7s/stackless_python_outperforms_googles_go/c0ftumi

    You can improve the performance on a per benchmark-basis by shrinking the thread stack size to one that fits the benchmark. E.g. 1M threads, with a 512 byte stack per thread, takes 2.7s

    $ time ./A +RTS -s -k0.5k
    

提交回复
热议问题