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

@ -25,6 +25,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { SettingLevel } from "../../settings/SettingLevel";
import { arrayFastClone } from "../../utils/arrays";
import { UPDATE_EVENT } from "../AsyncStore";
import { compare } from "../../utils/strings";
export const WIDGET_LAYOUT_EVENT_TYPE = "io.element.widgets.layout";
@ -240,7 +241,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
if (orderA === orderB) {
// We just need a tiebreak
return a.id.localeCompare(b.id);
return compare(a.id, b.id);
}
return orderA - orderB;