Skip to content

Commit 0a8362f

Browse files
committed
Revert "Merge pull request matrix-org#1801 from matrix-org/gsouquet/localecompare-perf"
This reverts commit e85038e, reversing changes made to a878588.
1 parent 901d53e commit 0a8362f

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

src/models/room.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2363,7 +2363,7 @@ export class Room extends EventEmitter {
23632363
return true;
23642364
});
23652365
// make sure members have stable order
2366-
otherMembers.sort((a, b) => utils.compare(a.userId, b.userId));
2366+
otherMembers.sort((a, b) => a.userId.localeCompare(b.userId));
23672367
// only 5 first members, immitate summaryHeroes
23682368
otherMembers = otherMembers.slice(0, 5);
23692369
otherNames = otherMembers.map((m) => m.name);

src/utils.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -677,16 +677,6 @@ export function lexicographicCompare(a: string, b: string): number {
677677
return (a < b) ? -1 : ((a === b) ? 0 : 1);
678678
}
679679

680-
const collator = new Intl.Collator();
681-
/**
682-
* Performant language-sensitive string comparison
683-
* @param a the first string to compare
684-
* @param b the second string to compare
685-
*/
686-
export function compare(a: string, b: string): number {
687-
return collator.compare(a, b);
688-
}
689-
690680
/**
691681
* This function is similar to Object.assign() but it assigns recursively and
692682
* allows you to ignore nullish values from the source

0 commit comments

Comments
 (0)