Skip to content

perf(frontend): ahocorasickを使ったワードミュート#15384

Open
tai-cha wants to merge 16 commits intomisskey-dev:developfrom
tai-cha:perf/wordmute-ahocorasick
Open

perf(frontend): ahocorasickを使ったワードミュート#15384
tai-cha wants to merge 16 commits intomisskey-dev:developfrom
tai-cha:perf/wordmute-ahocorasick

Conversation

@tai-cha
Copy link
Copy Markdown
Contributor

@tai-cha tai-cha commented Feb 2, 2025

What

エイホコラシック法を用いたワードミュート実装のパフォーマンス改善
(ただパフォーマンス測定はできていない)

ワードミュート情報渡し周り

  • ノート毎にmutedWordの情報を渡すのをやめ、main-boot呼び出し時とアカウント情報がアップデートされたときのみ生成するように

文字列比較周り

  • 単純な文字列判定にエイホコラシック法を採用
  • 正規表現もあらかじめコンパイルしておいて都度生成しない
  • Andマッチは一旦そのままで

Why

#15280

Additional info (optional)

  • フロントエンドでのパフォーマンス測定をしてみたいが、むずかしそう?
  • globalThisを使わないいい感じのキャッシュ法があれば使いたいが、storeを使う方法ではahocorasick.defaultを保持できなさそう

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions github-actions Bot added the packages/frontend Client side specific issue/PR label Feb 2, 2025
@tai-cha
Copy link
Copy Markdown
Contributor Author

tai-cha commented Feb 2, 2025

pnpm-lockを壊したみたいなのでいったんdraftに

@tai-cha tai-cha marked this pull request as draft February 2, 2025 03:24
@kakkokari-gtyih kakkokari-gtyih added this to the v2025.2.1 milestone Feb 2, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 2, 2025

Codecov Report

❌ Patch coverage is 85.52632% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.35%. Comparing base (b18d6b4) to head (6815480).
⚠️ Report is 1151 commits behind head on develop.

Files with missing lines Patch % Lines
packages/frontend/src/utility/check-word-mute.ts 91.66% 5 Missing ⚠️
packages/frontend/src/boot/main-boot.ts 0.00% 3 Missing ⚠️
...ontend/src/pages/settings/mute-block.word-mute.vue 0.00% 2 Missing ⚠️
...ackages/frontend/src/components/MkNoteDetailed.vue 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #15384       +/-   ##
============================================
- Coverage    46.17%   17.35%   -28.82%     
============================================
  Files         1704      823      -881     
  Lines       173310    74525    -98785     
  Branches      5295     1327     -3968     
============================================
- Hits         80023    12935    -67088     
+ Misses       92825    61147    -31678     
+ Partials       462      443       -19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tai-cha tai-cha marked this pull request as ready for review February 2, 2025 08:29
Comment thread packages/frontend/src/scripts/check-word-mute.ts Outdated
Comment thread packages/frontend/src/scripts/check-word-mute.ts Outdated
@tai-cha
Copy link
Copy Markdown
Contributor Author

tai-cha commented Feb 4, 2025

毎ノート毎にミュートワードを参照したり関数に渡すのもやめたからそのあたりもある程度最適化されているはず…?

@tai-cha tai-cha marked this pull request as draft February 5, 2025 06:46
@tai-cha tai-cha marked this pull request as ready for review February 8, 2025 01:42
@kakkokari-gtyih kakkokari-gtyih modified the milestones: v2025.2.1, [DO NOT MERGE THESE YET] v2025.3.0~, [DO NOT MERGE THESE YET] v2025.3.1~, v2025.3.0 Feb 24, 2025
@Sayamame-beans Sayamame-beans moved this from Todo to Needs to review in [実験中] 管理用 Feb 28, 2025
@samunohito samunohito modified the milestones: v2025.3.3, v2025.5.x Apr 15, 2025
@tai-cha
Copy link
Copy Markdown
Contributor Author

tai-cha commented May 6, 2025

コンフリクト解消とコード改善をしたけどdevelopの現コミットでも発生しているsharpの問題でCIのチェックは落ちていそう

@tai-cha
Copy link
Copy Markdown
Contributor Author

tai-cha commented May 12, 2025

追従+リアルタイムモードの概念ができたからワードミュートに設定のリロードを追加

@tamaina
Copy link
Copy Markdown
Contributor

tamaina commented Sep 8, 2025

フロントエンドでのパフォーマンス測定

シンプルなvueアプリを作って比較するとか?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages/frontend Client side specific issue/PR

Projects

Status: Needs to review

Development

Successfully merging this pull request may close these issues.

6 participants