Optimize ContinuationQueue and PlayerLoopRunner iteration

- Fix failing to eliminate array bounds check in PlayerLoopRunner.RunCore
- Reduce number of array bounds check of continuation iteration in ContinuationQueue.RunCore
master
RamType0 2020-08-28 17:12:03 +09:00
parent a65f4da7a2
commit ea950d8cec
2 changed files with 4 additions and 2 deletions

View File

@ -170,8 +170,8 @@ namespace Cysharp.Threading.Tasks.Internal
for (int i = 0; i < actionListCount; i++) for (int i = 0; i < actionListCount; i++)
{ {
var action = actionList[i];
actionList[i] = null; ref var action = ref actionList[i];//Reduce array bounds check
try try
{ {
@ -181,6 +181,7 @@ namespace Cysharp.Threading.Tasks.Internal
{ {
UnityEngine.Debug.LogException(ex); UnityEngine.Debug.LogException(ex);
} }
action = null;
} }
{ {

View File

@ -143,6 +143,7 @@ namespace Cysharp.Threading.Tasks.Internal
{ {
var j = tail - 1; var j = tail - 1;
var loopItems = this.loopItems;
// eliminate array-bound check for i // eliminate array-bound check for i
for (int i = 0; i < loopItems.Length; i++) for (int i = 0; i < loopItems.Length; i++)
{ {