Skip to content

perf(aria): drop debugName from signals#32904

Open
JoostK wants to merge 1 commit intoangular:mainfrom
JoostK:signal-like-devmode
Open

perf(aria): drop debugName from signals#32904
JoostK wants to merge 1 commit intoangular:mainfrom
JoostK:signal-like-devmode

Conversation

@JoostK
Copy link
Member

@JoostK JoostK commented Mar 8, 2026

The debugName would always be assigned into a reactive node, incurring the overhead of an additional property in each signal-like instance and introducing additional hidden classes for the JS VM to deal with.


I noticed this in heap snapshots:

Screenshot 2026-03-08 at 13 23 49

which is now:

Screenshot 2026-03-08 at 13 24 09

Since the name was assigned the empty string, I decided to remove it altogether.

The `debugName` would always be assigned into a reactive node, incurring
the overhead of an additional property in each signal-like instance _and_
introducing additional hidden classes for the JS VM to deal with.
@pullapprove pullapprove bot requested review from andrewseguin and crisbeto March 8, 2026 12:25
@angular-robot angular-robot bot added the area: performance Issues related to performance label Mar 8, 2026
export function computed<T>(computation: () => T): SignalLike<T> {
const computed = createComputed(computation);
// TODO: Remove the `toString` after https://github.com/angular/angular/pull/65948 is merged.
computed.toString = () => `[Computed: ${computed()}]`;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the toString because the linked issue has been merged, but I realized this isn't identical; computed() picks up a reactive dependency whereas the primitives' toString() implementation would not.

Depending on how angular/angular#67511 gets resolved this may need to change here as well, as I think it's beneficial to keep this behavior identical to Angular's primary signal behaviors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: performance Issues related to performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant