Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Conversation

germain-gg
Copy link
Contributor

@germain-gg germain-gg commented Jun 1, 2021

There is a UI blocking operation for large member list, taking approximately 1.2 seconds to sort the array which made me look at what is causing the issue

The culprit was String.prototype.localeCompare. It turns out that creating an Intl.Collator ahead of time speads up the process immensely
Minor optimisations were also made to avoid applying regexes on every sort callback

I went ahead and replaced every occurence of localeCompare in the rest of the platform to use Intl.Collator. We will likely get a performance boost in room list filtering for large accounts as it was using localeCompare there

Before 🐌

Screen Shot 2021-06-01 at 16 42 49

After 🐎

Screen Shot 2021-06-01 at 17 21 55

@germain-gg germain-gg requested review from a team and removed request for a team June 1, 2021 16:28
@germain-gg germain-gg marked this pull request as draft June 1, 2021 16:30
@germain-gg germain-gg force-pushed the gsouquet/member-list-sort branch from f17c342 to d7a5547 Compare June 2, 2021 09:42
@germain-gg germain-gg requested a review from a team June 2, 2021 09:45
@germain-gg germain-gg marked this pull request as ready for review June 2, 2021 09:45
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

lgtm other than the import

@germain-gg germain-gg merged commit 96f5d3a into develop Jun 2, 2021
@germain-gg germain-gg deleted the gsouquet/member-list-sort branch June 2, 2021 10:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants