Skip to content

Commit

Permalink
[threadpool] cache processor count
Browse files Browse the repository at this point in the history
On top of mono/corefx#369 this improves the execution time of `System.Core-xunit` on Linux/ARM64 by 2x, so from:

```console
$ make -C mcs/class/System.Core run-xunit-test
[...]
=== TEST EXECUTION SUMMARY ===
   net_4_x_System.Core_xunit-test  Total: 48774, Errors: 0, Failed: 0, Skipped: 6, Time: 131.143s
```
to
```console
$ make -C mcs/class/System.Core run-xunit-test
[...]
=== TEST EXECUTION SUMMARY ===
   net_4_x_System.Core_xunit-test  Total: 48774, Errors: 0, Failed: 0, Skipped: 6, Time: 74.636s
```

This is only relevant for non-netcore. The CoreCLR folks just recently fixed something similar (thanks to Marek sharing this link): dotnet/coreclr#27543
  • Loading branch information
lewurm committed Oct 31, 2019
1 parent ca72dee commit 3fdeae1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ internal static class ThreadPoolGlobals
#if MONO
public const uint tpQuantum = 30U;

public static int processorCount => Environment.ProcessorCount;
public static int processorCount = Environment.ProcessorCount;

public static bool tpHosted => ThreadPool.IsThreadPoolHosted();

Expand Down

0 comments on commit 3fdeae1

Please sign in to comment.