Skip to content

Commit

Permalink
perf: 优化数据解析速度 (#128)
Browse files Browse the repository at this point in the history
* perf: 优化数据库加载速度
  • Loading branch information
neooier authored Jan 14, 2025
1 parent c68ee2c commit 4f8ddeb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libs/Counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export class Counter<K> extends Map<K, number> {
super(entries);
}

#counter_common(n: number, k: 1 | -1) {
private _counter_common(n: number, k: 1 | -1) {
const all = [...this.entries()].sort((x, y) => {
if (x[1] !== y[1]) return k * (y[1] - x[1]);
return x[0] < y[0] ? -1 : x[0] > y[0] ? 1 : 0;
Expand All @@ -17,11 +17,11 @@ export class Counter<K> extends Map<K, number> {
}

least_common(n: number) {
return this.#counter_common(n, -1);
return this._counter_common(n, -1);
}

most_common(n: number) {
return this.#counter_common(n, 1);
return this._counter_common(n, 1);
}

update(key: K, value = 1) {
Expand Down

0 comments on commit 4f8ddeb

Please sign in to comment.