mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-26 02:30:18 +00:00
perf : 优化异步操作系统的繁忙检测机制
默认情况下不必检测
This commit is contained in:
@@ -33,6 +33,7 @@ namespace YooAsset
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
// NOTE : 单次调用开销约1微秒
|
||||||
return _watch.ElapsedMilliseconds - _frameTime >= MaxTimeSlice;
|
return _watch.ElapsedMilliseconds - _frameTime >= MaxTimeSlice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,10 +83,11 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新进行中的异步操作
|
// 更新进行中的异步操作
|
||||||
|
bool checkBusy = MaxTimeSlice < long.MaxValue;
|
||||||
_frameTime = _watch.ElapsedMilliseconds;
|
_frameTime = _watch.ElapsedMilliseconds;
|
||||||
for (int i = 0; i < _operations.Count; i++)
|
for (int i = 0; i < _operations.Count; i++)
|
||||||
{
|
{
|
||||||
if (IsBusy)
|
if (checkBusy && IsBusy)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
var operation = _operations[i];
|
var operation = _operations[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user