Optimize GC for vector property source.
This commit is contained in:
@@ -13,6 +13,8 @@ namespace Cryville.Crtr {
|
||||
|
||||
static readonly byte[] _nullbuf = new byte[0];
|
||||
readonly byte[] _numbuf = new byte[4];
|
||||
readonly PropSrc _vecsrc;
|
||||
Vector _vec;
|
||||
static readonly int _var_w = IdentifierManager.SharedInstance.Request("w");
|
||||
static readonly int _var_h = IdentifierManager.SharedInstance.Request("h");
|
||||
static readonly int _var_current_time = IdentifierManager.SharedInstance.Request("current_time");
|
||||
@@ -32,8 +34,9 @@ namespace Cryville.Crtr {
|
||||
prop.Get(out type, out value);
|
||||
}
|
||||
else if (ContextState != null && ChartPlayer.motionRegistry.ContainsKey(id)) {
|
||||
var vec = ContextState.GetRawValue(id);
|
||||
VectorSrc.Construct(() => vec).Get(out type, out value);
|
||||
_vec = ContextState.GetRawValue(id);
|
||||
_vecsrc.Invalidate();
|
||||
_vecsrc.Get(out type, out value);
|
||||
}
|
||||
else if (ContextState != null && ContextState.Handler.PropSrcs.TryGetValue(name, out prop)) {
|
||||
prop.Get(out type, out value);
|
||||
@@ -140,6 +143,7 @@ namespace Cryville.Crtr {
|
||||
public PdtEvaluator() {
|
||||
ContextCascadeBlocks.Push(0);
|
||||
for (int i = 0; i < ContextCascade.Length; i++) ContextCascade[i] = new Dictionary<int, PropSrc>();
|
||||
_vecsrc = new VectorSrc(() => _vec);
|
||||
|
||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("screen_edge"), new func_screen_edge(() => ContextTransform));
|
||||
_ctxops.Add(IdentifierManager.SharedInstance.Request("int"), new func_int(() => ContextSelfValue));
|
||||
|
Reference in New Issue
Block a user