Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control flow list diffing faster update #52227

Conversation

pkozlowski-opensource
Copy link
Member

No description provided.

The at operation is private and doesn't have to be part of the public interface.
We can speedup items comparision by having access to raw values
and delay key calculation in certain conditions.
Assuming that the trackBy function is a pure derivation from the collection
object and its index, we can skip trackBy calculation if items in the live
and new colelction have the same identity and index. Additionally this change
minimizes access to the LContainer array.
This change avoid re-creation of the LiveCollectionLContainerImpl instance
every time the repeater runs (on every change detection).
@pkozlowski-opensource pkozlowski-opensource added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime labels Oct 16, 2023
@ngbot ngbot bot modified the milestone: Backlog Oct 16, 2023
@pkozlowski-opensource pkozlowski-opensource marked this pull request as ready for review October 16, 2023 17:44
Re-organize code to minimize number of calls to the
trackBy function.
trackBy: TrackByFunction<V>): number {
if (liveIdx === newIdx && Object.is(liveValue, newValue)) {
// matching and no value identity to update
return 1;
Copy link
Member

Choose a reason for hiding this comment

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

We can make constants for these (or a const enum) to give semantic meaning to the return values.

@pkozlowski-opensource pkozlowski-opensource added action: merge The PR is ready for merge by the caretaker target: rc This PR is targeted for the next release-candidate and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 17, 2023
@pkozlowski-opensource
Copy link
Member Author

This PR was merged into the repository by commit 7818d5c.

pkozlowski-opensource added a commit that referenced this pull request Oct 18, 2023
We can speedup items comparision by having access to raw values
and delay key calculation in certain conditions.

PR Close #52227
pkozlowski-opensource added a commit that referenced this pull request Oct 18, 2023
…on (#52227)

Assuming that the trackBy function is a pure derivation from the collection
object and its index, we can skip trackBy calculation if items in the live
and new colelction have the same identity and index. Additionally this change
minimizes access to the LContainer array.

PR Close #52227
pkozlowski-opensource added a commit that referenced this pull request Oct 18, 2023
This change avoid re-creation of the LiveCollectionLContainerImpl instance
every time the repeater runs (on every change detection).

PR Close #52227
pkozlowski-opensource added a commit that referenced this pull request Oct 18, 2023
Re-organize code to minimize number of calls to the
trackBy function.

PR Close #52227
pkozlowski-opensource added a commit that referenced this pull request Oct 18, 2023
…2227)

The at operation is private and doesn't have to be part of the public interface.

PR Close #52227
pkozlowski-opensource added a commit that referenced this pull request Oct 18, 2023
We can speedup items comparision by having access to raw values
and delay key calculation in certain conditions.

PR Close #52227
pkozlowski-opensource added a commit that referenced this pull request Oct 18, 2023
…on (#52227)

Assuming that the trackBy function is a pure derivation from the collection
object and its index, we can skip trackBy calculation if items in the live
and new colelction have the same identity and index. Additionally this change
minimizes access to the LContainer array.

PR Close #52227
pkozlowski-opensource added a commit that referenced this pull request Oct 18, 2023
This change avoid re-creation of the LiveCollectionLContainerImpl instance
every time the repeater runs (on every change detection).

PR Close #52227
pkozlowski-opensource added a commit that referenced this pull request Oct 18, 2023
Re-organize code to minimize number of calls to the
trackBy function.

PR Close #52227
@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 Nov 18, 2023
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
…gular#52227)

The at operation is private and doesn't have to be part of the public interface.

PR Close angular#52227
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
We can speedup items comparision by having access to raw values
and delay key calculation in certain conditions.

PR Close angular#52227
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
…on (angular#52227)

Assuming that the trackBy function is a pure derivation from the collection
object and its index, we can skip trackBy calculation if items in the live
and new colelction have the same identity and index. Additionally this change
minimizes access to the LContainer array.

PR Close angular#52227
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
This change avoid re-creation of the LiveCollectionLContainerImpl instance
every time the repeater runs (on every change detection).

PR Close angular#52227
ChellappanRajan pushed a commit to ChellappanRajan/angular that referenced this pull request Jan 23, 2024
Re-organize code to minimize number of calls to the
trackBy function.

PR Close angular#52227
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 target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants