mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-10-05 23:47:25 +08:00
RenderableCache performance improvement
This commit is contained in:
parent
d9247de1c4
commit
858cab95f2
@ -221,11 +221,13 @@ namespace CodeWalker.Rendering
|
|||||||
public long CacheUse = 0;
|
public long CacheUse = 0;
|
||||||
public double CacheTime;
|
public double CacheTime;
|
||||||
public int LoadedCount = 0;//temporary, per loop
|
public int LoadedCount = 0;//temporary, per loop
|
||||||
|
private long LastFrameTime = 0;
|
||||||
|
|
||||||
public RenderableCacheLookup(long limit, double time)
|
public RenderableCacheLookup(long limit, double time)
|
||||||
{
|
{
|
||||||
CacheLimit = limit;
|
CacheLimit = limit;
|
||||||
CacheTime = time;
|
CacheTime = time;
|
||||||
|
LastFrameTime = DateTime.UtcNow.ToBinary();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CurrentLoadedCount
|
public int CurrentLoadedCount
|
||||||
@ -315,6 +317,7 @@ namespace CodeWalker.Rendering
|
|||||||
|
|
||||||
public void RenderThreadSync()
|
public void RenderThreadSync()
|
||||||
{
|
{
|
||||||
|
LastFrameTime = DateTime.UtcNow.ToBinary();
|
||||||
TVal item;
|
TVal item;
|
||||||
while (itemsToUnload.TryPop(out item))
|
while (itemsToUnload.TryPop(out item))
|
||||||
{
|
{
|
||||||
@ -339,7 +342,7 @@ namespace CodeWalker.Rendering
|
|||||||
item.Init(key);
|
item.Init(key);
|
||||||
cacheitems.Add(key, item);
|
cacheitems.Add(key, item);
|
||||||
}
|
}
|
||||||
Interlocked.Exchange(ref item.LastUseTime, DateTime.UtcNow.ToBinary());
|
Interlocked.Exchange(ref item.LastUseTime, LastFrameTime);
|
||||||
if ((!item.IsLoaded) && (!item.LoadQueued))// ||
|
if ((!item.IsLoaded) && (!item.LoadQueued))// ||
|
||||||
{
|
{
|
||||||
item.LoadQueued = true;
|
item.LoadQueued = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user