use Intl.Collator over String.prototype.localeCompare for better performance

This commit is contained in:
Germain Souquet 2021-06-02 10:42:17 +01:00
parent c6c1e09cae
commit d7a5547d80
11 changed files with 49 additions and 27 deletions

View file

@ -28,6 +28,7 @@ import WidgetUtils from "../utils/WidgetUtils";
import {MatrixClientPeg} from "../MatrixClientPeg";
import SettingsStore from "../settings/SettingsStore";
import url from 'url';
import { compare } from "../utils/strings";
const KIND_PREFERENCE = [
// Ordered: first is most preferred, last is least preferred.
@ -152,7 +153,7 @@ export class IntegrationManagers {
if (kind === Kind.Account) {
// Order by state_keys (IDs)
managers.sort((a, b) => a.id.localeCompare(b.id));
managers.sort((a, b) => compare(a.id, b.id));
}
ordered.push(...managers);