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

Improve ListViewSubItem.Text performance #11401

Merged
merged 2 commits into from
May 22, 2024

Conversation

elachlan
Copy link
Contributor

@elachlan elachlan commented May 19, 2024

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
Contributor Author

@Olina-Zhang can your team please test this?

Copy link

codecov bot commented May 19, 2024

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
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
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
Member

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

@Olina-Zhang
Copy link
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

Copy link
Member

@Tanya-Solyanik Tanya-Solyanik left a comment

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
8 checks passed
@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
Member

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
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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