Skip to content

Conversation

@alxhub
Copy link
Member

@alxhub alxhub commented May 28, 2024

When a consumer switches its liveness state, it gets added to / removed from the consumer list of all of its producers. This operation is transitive, so if its producer is also a consumer and its liveness state is switched, then the change is applied recursively.

Note that this only matters if the producer is also a consumer. However, the logic in producerAddLiveConsumer / producerRemoveLiveConsumerAtIndex coerced the producer node into a producer & consumer node, which allocated extra arrays into the node structure that are never used. This didn't affect correctness, but increased the memory usage of plain signal nodes (which are just producers, never consumers).

This fix changes the logic in those operations to simply check if a producer is also a consumer instead of coercing it into one.

Other information

When a consumer switches its liveness state, it gets added to / removed from
the consumer list of all of its producers. This operation is transitive, so
if its producer is *also* a consumer and *its* liveness state is switched,
then the change is applied recursively.

Note that this only matters *if* the producer is also a consumer. However,
the logic in `producerAddLiveConsumer` / `producerRemoveLiveConsumerAtIndex`
coerced the producer node into a producer & consumer node, which allocated
extra arrays into the node structure that are never used. This didn't affect
correctness, but increased the memory usage of plain signal nodes (which are
just producers, never consumers).

This fix changes the logic in those operations to simply check if a producer
is also a consumer instead of coercing it into one.
@pullapprove pullapprove bot requested review from atscott and csmick May 28, 2024 22:56
@pullapprove pullapprove bot added the requires: TGP This PR requires a passing TGP before merging is allowed label May 28, 2024
@alxhub alxhub added action: merge The PR is ready for merge by the caretaker and removed requires: TGP This PR requires a passing TGP before merging is allowed labels May 28, 2024
@pullapprove pullapprove bot added requires: TGP This PR requires a passing TGP before merging is allowed labels May 28, 2024
@alxhub alxhub added target: patch This PR is targeted for the next patch release merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed requires: TGP This PR requires a passing TGP before merging is allowed labels May 28, 2024
@pullapprove pullapprove bot added the requires: TGP This PR requires a passing TGP before merging is allowed label May 28, 2024
@alxhub
Copy link
Member Author

alxhub commented May 28, 2024

Caretaker: TGP not needed; no significant behavioral change.

@pkozlowski-opensource pkozlowski-opensource added the area: core Issues related to the framework runtime label May 29, 2024
@ngbot ngbot bot added this to the Backlog milestone May 29, 2024
@alxhub alxhub removed request for atscott and csmick May 29, 2024 22:31
@pullapprove pullapprove bot requested a review from csmick May 29, 2024 22:31
@alxhub
Copy link
Member Author

alxhub commented May 30, 2024

Caretaker: consider this globally approved :) Pawel's review is sufficient.

@thePunderWoman
Copy link
Contributor

TESTED=TGP Not required. No significant behavioral change.

thePunderWoman pushed a commit that referenced this pull request May 30, 2024
…#56140)

When a consumer switches its liveness state, it gets added to / removed from
the consumer list of all of its producers. This operation is transitive, so
if its producer is *also* a consumer and *its* liveness state is switched,
then the change is applied recursively.

Note that this only matters *if* the producer is also a consumer. However,
the logic in `producerAddLiveConsumer` / `producerRemoveLiveConsumerAtIndex`
coerced the producer node into a producer & consumer node, which allocated
extra arrays into the node structure that are never used. This didn't affect
correctness, but increased the memory usage of plain signal nodes (which are
just producers, never consumers).

This fix changes the logic in those operations to simply check if a producer
is also a consumer instead of coercing it into one.

PR Close #56140
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository by commit 1081c8d.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note requires: TGP This PR requires a passing TGP before merging is allowed target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants