Skip to content

Commit

Permalink
Revert "Merge pull request matrix-org#1801 from matrix-org/gsouquet/l…
Browse files Browse the repository at this point in the history
…ocalecompare-perf"

This reverts commit e85038e, reversing
changes made to a878588.
  • Loading branch information
bradjones1 committed Mar 2, 2022
1 parent 901d53e commit 0a8362f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion src/models/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2363,7 +2363,7 @@ export class Room extends EventEmitter {
return true;
});
// make sure members have stable order
otherMembers.sort((a, b) => utils.compare(a.userId, b.userId));
otherMembers.sort((a, b) => a.userId.localeCompare(b.userId));
// only 5 first members, immitate summaryHeroes
otherMembers = otherMembers.slice(0, 5);
otherNames = otherMembers.map((m) => m.name);
Expand Down
10 changes: 0 additions & 10 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,16 +677,6 @@ export function lexicographicCompare(a: string, b: string): number {
return (a < b) ? -1 : ((a === b) ? 0 : 1);
}

const collator = new Intl.Collator();
/**
* Performant language-sensitive string comparison
* @param a the first string to compare
* @param b the second string to compare
*/
export function compare(a: string, b: string): number {
return collator.compare(a, b);
}

/**
* This function is similar to Object.assign() but it assigns recursively and
* allows you to ignore nullish values from the source
Expand Down

0 comments on commit 0a8362f

Please sign in to comment.