Skip to content

Commit

Permalink
Reduce memory allocation for debug names
Browse files Browse the repository at this point in the history
  • Loading branch information
vanifatovvlad committed Jul 11, 2022
1 parent b929ab5 commit 732b063
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 2 additions & 3 deletions Runtime/State.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public StateCollectionHolder(Lifetime lifetime, BuildContext context, Func<Build
{
_context = context;
_builder = builder;
_statesAtom = Atom.Computed(lifetime, ComputeStates, debugName: $"StateCollectionHolder::State");
_statesAtom = Atom.Computed(lifetime, ComputeStates);

lifetime.Register(DeactivateStates);
}
Expand Down Expand Up @@ -148,8 +148,7 @@ public StateHolder(Lifetime lifetime, BuildContext context, WidgetBuilder<TWidge
{
_context = context;
_builder = builder;
_stateAtom = Atom.Computed(lifetime, ComputeState,
debugName: $"StateHolder<{typeof(TWidget)}, {typeof(TState)}>::State");
_stateAtom = Atom.Computed(lifetime, ComputeState);
lifetime.Register(DeactivateState);
}

Expand Down
10 changes: 4 additions & 6 deletions Runtime/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected Vector2Int Bounds
{
if (_bounds == null)
{
_bounds = Atom.Value(Vector2Int.zero, debugName: "View.bounds");
_bounds = Atom.Value(Vector2Int.zero);
}

return _bounds.Value;
Expand Down Expand Up @@ -84,11 +84,9 @@ private void Initialize()
return;
}

_nextState = Atom.Value<TState>(ViewLifetime, null, debugName: $"View<{typeof(TState)}>({name})::State");
_doRebind = Atom.Computed(ViewLifetime, DoRebind, debugName: $"View<{typeof(TState)}>({name})::Bind()",
keepAlive: true);
_doRender = Atom.Computed(ViewLifetime, DoRender, debugName: $"View<{typeof(TState)}>({name})::Render()",
keepAlive: true);
_nextState = Atom.Value<TState>(ViewLifetime, null);
_doRebind = Atom.Computed(ViewLifetime, DoRebind, keepAlive: true);
_doRender = Atom.Computed(ViewLifetime, DoRender, keepAlive: true);
}

void IView.SetSource(IViewState newSource, bool link)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "com.codewriter.unimob.ui",
"displayName": "UniMob.UI",
"description": "A declarative library for building reactive user interfaces",
"version": "0.4.9",
"version": "0.4.10",
"unity": "2019.3",
"license": "MIT",
"keywords": [
Expand Down

0 comments on commit 732b063

Please sign in to comment.