Skip to content

Improve ListViewSubItem.Text performance - #11401

Merged
LeafShi1 merged 2 commits into
dotnet:mainfrom
elachlan:ListViewSubItem-Text-Perf
May 22, 2024
Merged

LeafShi1 merged 2 commits into
dotnet:mainfrom
elachlan:ListViewSubItem-Text-Perf

Conversation

@elachlan

@elachlan elachlan commented May 19, 2024 •

Copy link
Copy Markdown
Contributor

Fixes #10963

Change ListViewSubItem.Text to pass index to ListViewItem.UpdateSubItems to avoid loop.

Microsoft Reviewers: Open in CodeFlow

@elachlan
elachlan requested a review from a team as a code owner May 19, 2024 11:50
@elachlan elachlan added the waiting-review This item is waiting on review by one or more members of team label May 19, 2024
@elachlan

Copy link
Copy Markdown
Contributor Author

@Olina-Zhang can your team please test this?

@codecov

codecov Bot commented May 19, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.26543%. Comparing base (0aa3a4d) to head (e2da404).

Additional details and impacted files
@@                 Coverage Diff                 @@
##                main      #11401         +/-   ##
===================================================
+ Coverage   74.26256%   74.26543%   +0.00287%     
===================================================
  Files           3025        3025                 
  Lines         626861      626861                 
  Branches       46742       46742                 
===================================================
+ Hits          465523      465541         +18     
+ Misses        157993      157977         -16     
+ Partials        3345        3343          -2     
Flag Coverage Δ
Debug 74.26543% <100.00000%> (+0.00287%) ⬆️
integration 17.99452% <12.50000%> (-0.00141%) ⬇️
production 46.99221% <100.00000%> (+0.00630%) ⬆️
test 96.98684% <ø> (ø)
unit 43.94371% <100.00000%> (-0.02247%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@Olina-Zhang

Copy link
Copy Markdown
Member

Hi @elachlan, tested before and after this PR change, I didn't see any behavior difference when updating one ListViewSubItem's Text property, noticed entire row is blinking once(The recorded video doesn't seem to show it), is it the issue? Not sure if I understand the client's question correctly.

ListViewSubItem.sText.mp4

@elachlan

Copy link
Copy Markdown
Contributor Author

Hi @Olina-Zhang, That is fantastic. There shouldn't be any behavior changes.

The issue will arise if there is a large number of sub items (1000) it will be very slow to update. After the change it should be very quick.

@Olina-Zhang

Copy link
Copy Markdown
Member

That's because my test was a bit small, I'll try a bigger one.

@Olina-Zhang

Copy link
Copy Markdown
Member

If ListView has a large number of sub items (>1000), updating the text of ListViewSubItem is also quite fast with before and after your PR change, looks like no difference.

LargeListViewSubItem.sText.mp4

@Tanya-Solyanik Tanya-Solyanik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The change looks reasonable. Probably updating text for all subitems was an oversight in the original implementation.

@Tanya-Solyanik Tanya-Solyanik removed the waiting-review This item is waiting on review by one or more members of team label May 21, 2024
@LeafShi1
LeafShi1 merged commit af38079 into dotnet:main May 22, 2024
@dotnet-policy-service dotnet-policy-service Bot added this to the 9.0 Preview5 milestone May 22, 2024
@elachlan
elachlan deleted the ListViewSubItem-Text-Perf branch May 22, 2024 05:56
@John-Qiao

Copy link
Copy Markdown
Contributor

Verified this issue on 9.0.100-preview.5.24273.4 with dlls built from winforms repo of main branch, the result is same as above which Olina did.

11401-testresult.mp4

@John-Qiao

Copy link
Copy Markdown
Contributor

Verified this issue with 9.0.100-preview.5.24304.3 test pass build, it was fixed. Test result is same as above.

@github-actions github-actions Bot locked and limited conversation to collaborators Jul 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updating ListView.ListViewItem.ListViewSubItem Text or Name values updates them all, why? is this normal?

5 participants