Optimize GC for temporary anchor event injection.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Cryville.Common;
|
using Cryville.Common;
|
||||||
|
using Cryville.Common.Buffers;
|
||||||
using Cryville.Crtr.Components;
|
using Cryville.Crtr.Components;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -132,19 +133,31 @@ namespace Cryville.Crtr.Event {
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static readonly SimpleObjectPool<StampedEvent.Anchor> anchorEvPool
|
||||||
|
= new SimpleObjectPool<StampedEvent.Anchor>(1024);
|
||||||
public virtual void Update(ContainerState s, StampedEvent ev) {
|
public virtual void Update(ContainerState s, StampedEvent ev) {
|
||||||
bool flag = !Awoken && s.CloneType >= 2 && s.CloneType < 16;
|
bool flag = !Awoken && s.CloneType >= 2 && s.CloneType < 16;
|
||||||
if (flag) PreAwake(s);
|
if (flag) PreAwake(s);
|
||||||
if (s.CloneType == 0) {
|
|
||||||
ts.Bus.PushTempEvent(new StampedEvent.Anchor { Time = s.Time, Container = s.Container, Name = _a_cur });
|
|
||||||
}
|
|
||||||
if (s.CloneType <= 2) if (gogroup) skinContainer.MatchDynamic(s);
|
if (s.CloneType <= 2) if (gogroup) skinContainer.MatchDynamic(s);
|
||||||
if (flag) Awake(s);
|
if (flag) Awake(s);
|
||||||
|
if (s.CloneType == 0) {
|
||||||
|
var tev = anchorEvPool.Rent();
|
||||||
|
tev.Time = s.Time;
|
||||||
|
tev.Container = s.Container;
|
||||||
|
tev.Name = _a_cur;
|
||||||
|
ts.Bus.PushTempEvent(tev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public virtual void ExUpdate(ContainerState s, StampedEvent ev) {
|
public virtual void ExUpdate(ContainerState s, StampedEvent ev) {
|
||||||
if (ev is StampedEvent.Anchor) { OpenAnchor(((StampedEvent.Anchor)ev).Name); }
|
if (ev is StampedEvent.Anchor) {
|
||||||
if (s.CloneType <= 2) if (gogroup) skinContainer.MatchDynamic(s);
|
var tev = (StampedEvent.Anchor)ev;
|
||||||
if (ev is StampedEvent.Anchor) { CloseAnchor(((StampedEvent.Anchor)ev).Name); }
|
if (gogroup) {
|
||||||
|
OpenAnchor(tev.Name);
|
||||||
|
skinContainer.MatchDynamic(s);
|
||||||
|
CloseAnchor(tev.Name);
|
||||||
|
}
|
||||||
|
anchorEvPool.Return(tev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public virtual void MotionUpdate(byte ct, Chart.Motion ev) { }
|
public virtual void MotionUpdate(byte ct, Chart.Motion ev) { }
|
||||||
public virtual void EndUpdate(ContainerState s) {
|
public virtual void EndUpdate(ContainerState s) {
|
||||||
|
|||||||
Reference in New Issue
Block a user