简体   繁体   English

Mono C#编译器是否在编译时对循环进行任何并行化?

[英]Does the Mono C# compiler do any parallelization of a loop at compile time?

not much more than the title says. 没有比标题说的多。 If I do: 如果我做:

  int[] arr = new int[(long)Math.Pow(2, 25)];
  for (int j = 0; j < arr.Length; j++)
    arr[j] = j;

will the compiler parallelize this code in any way? 编译器会以任何方式并行化此代码吗? I'm asking because I see 3 of the 4 cores light up when run. 我问,因为我看到4个核心中有3个在运行时亮起。

Thanks. 谢谢。

Simply, by default I believe that no it doesn't; 简单地说,默认情况下,我相信不,它没有; because MS.Net doesn't. 因为MS.Net没有。

That's not to say that .Net isn't firing on all your cores, but the snippet you posted should be a single thread operation. 这并不是说.Net没有在你的所有内核上启动,但是你发布的代码片段应该是单线程操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM