Break up algorithms and use the new layering

Sorting and ordering has now been split apart. The ImportanceAlgorithm also finally makes use of the sorting.

So far metrics look okay at 3ms for a simple account, though this could potentially get worse due to the multiple loops involved (one for tags, one for categories, one for ordering). We might be able to feed a whole list of rooms into the thing and have it regenerate the lists on demand.
This commit is contained in:
Travis Ralston 2020-04-29 16:57:06 -06:00
parent e7fffee175
commit d244eeb5d5
11 changed files with 283 additions and 41 deletions

View file

@ -19,10 +19,11 @@ import { MatrixClient } from "matrix-js-sdk/src/client";
import { ActionPayload, defaultDispatcher } from "../../dispatcher-types";
import SettingsStore from "../../settings/SettingsStore";
import { DefaultTagID, OrderedDefaultTagIDs, TagID } from "./models";
import { Algorithm, ITagMap, ITagSortingMap, ListAlgorithm, SortAlgorithm } from "./algorithms/Algorithm";
import { Algorithm } from "./algorithms/list_ordering/Algorithm";
import TagOrderStore from "../TagOrderStore";
import { getAlgorithmInstance } from "./algorithms";
import { getListAlgorithmInstance } from "./algorithms/list_ordering";
import { AsyncStore } from "../AsyncStore";
import { ITagMap, ITagSortingMap, ListAlgorithm, SortAlgorithm } from "./algorithms/models";
interface IState {
tagsEnabled?: boolean;
@ -172,7 +173,7 @@ class _RoomListStore extends AsyncStore<ActionPayload> {
}
private setAlgorithmClass() {
this.algorithm = getAlgorithmInstance(this.state.preferredAlgorithm);
this.algorithm = getListAlgorithmInstance(this.state.preferredAlgorithm);
}
private async regenerateAllLists() {