Commit 45dad1e
reduce overhead when running in no main thread mode (#1502)
* Do not track nested factory when there is no main thread
Generally, post to context would not be used as SwitchToMainThread is no-op in this context. Even it is being called under certain corner cases, it would just queue the same work item to the thread pool multiple times, so better to prevent the allocation in the first place.
* Do not turn on SynchronouslyBlockingMainThread flag on when the JTF is used in no main thread mode.
Because IsOnMainThread is just to check the thread id, this can be turned on randomly when the code is running in the initial thread pool thread. It would turn on expensive dependency tracking graph, which is not what we expect to do.
* stop creating main thread synchronization context when running in no main thread mode.
---------
Co-authored-by: Lifeng Lu <[email protected]>1 parent e700b50 commit 45dad1e
File tree
2 files changed
+18
-16
lines changed- src/Microsoft.VisualStudio.Threading
2 files changed
+18
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| |||
147 | 146 | | |
148 | 147 | | |
149 | 148 | | |
150 | | - | |
| 149 | + | |
151 | 150 | | |
152 | 151 | | |
153 | 152 | | |
| |||
321 | 320 | | |
322 | 321 | | |
323 | 322 | | |
324 | | - | |
| 323 | + | |
325 | 324 | | |
326 | 325 | | |
327 | 326 | | |
| |||
977 | 976 | | |
978 | 977 | | |
979 | 978 | | |
980 | | - | |
| 979 | + | |
981 | 980 | | |
982 | 981 | | |
983 | 982 | | |
| |||
Lines changed: 15 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
1017 | 1017 | | |
1018 | 1018 | | |
1019 | 1019 | | |
1020 | | - | |
1021 | | - | |
1022 | | - | |
1023 | | - | |
1024 | | - | |
1025 | | - | |
| 1020 | + | |
1026 | 1021 | | |
1027 | | - | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
1028 | 1028 | | |
1029 | | - | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
1030 | 1033 | | |
1031 | | - | |
1032 | 1034 | | |
1033 | | - | |
| 1035 | + | |
| 1036 | + | |
1034 | 1037 | | |
1035 | 1038 | | |
1036 | 1039 | | |
| |||
0 commit comments