Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

tai-cha
Copy link
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
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
Copy link

codecov bot commented Feb 2, 2025

Codecov Report

Attention: Patch coverage is 83.01887% with 18 lines in your changes missing coverage. Please review.

Project coverage is 19.52%. Comparing base (9230ee5) to head (32cf70e).
Report is 28 commits behind head on develop.

Files with missing lines Patch % Lines
packages/frontend/src/scripts/check-word-mute.ts 85.39% 13 Missing ⚠️
packages/frontend/src/boot/main-boot.ts 0.00% 4 Missing ⚠️
...ackages/frontend/src/components/MkNoteDetailed.vue 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #15384       +/-   ##
============================================
- Coverage    38.68%   19.52%   -19.17%     
============================================
  Files         1603      768      -835     
  Lines       204302   111571    -92731     
  Branches      4042     1280     -2762     
============================================
- Hits         79040    21780    -57260     
+ Misses      124622    89203    -35419     
+ Partials       640      588       -52     

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

@tai-cha tai-cha marked this pull request as ready for review February 2, 2025 08:29
@tai-cha
Copy link
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
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
Development

Successfully merging this pull request may close these issues.

3 participants