Fastest way to calculate primes in C#?

后端 未结 8 810
孤独总比滥情好
孤独总比滥情好 2021-02-03 09:56

I actually have an answer to my question but it is not parallelized so I am interested in ways to improve the algorithm. Anyway it might be useful as-is for some people.

8条回答
  •  走了就别回头了
    2021-02-03 10:47

    You also should consider a possible change of algorithms.

    Consider that it may be cheaper to simply add the elements to your list, as you find them.

    Perhaps preallocating space for your list, will make it cheaper to build/populate.

提交回复
热议问题