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): use setInterval instead of setTimeout chain in MkTime #10981

Merged
merged 11 commits into from
Jul 4, 2023

Conversation

tamaina
Copy link
Contributor

@tamaina tamaina commented Jun 9, 2023

What

MkTimeでは、setTimeoutをチェーンするのではなくsetInterval(10*1000)を回し続けるようにする

Why

特にスリープから復帰した際のパフォーマンス向上?

Additional info (optional)

p1.a9z.devで動作中

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 Jun 9, 2023
@github-actions github-actions bot requested a review from syuilo June 9, 2023 04:34
@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Merging #10981 (a417fc5) into develop (aa92df4) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop   #10981      +/-   ##
===========================================
- Coverage    77.36%   77.33%   -0.03%     
===========================================
  Files          908      907       -1     
  Lines        91588    91495      -93     
  Branches      7547     7550       +3     
===========================================
- Hits         70856    70761      -95     
- Misses       20732    20734       +2     
Impacted Files Coverage Δ
packages/frontend/src/components/global/MkTime.vue 88.88% <100.00%> (+1.19%) ⬆️

... and 2 files with indirect coverage changes

@syuilo
Copy link
Member

syuilo commented Jun 10, 2023

今は無駄な更新を避けるため時間が経過しているほど更新の頻度が少なくなるようになってるけど、このPRで更新間隔が一律になるから全体的にパフォーマンス改善するかは微妙かも

@tamaina
Copy link
Contributor Author

tamaina commented Jun 10, 2023

Safariだとバックグラウンド状態から復帰した場合の動きがマシになった気がする(気がするだけかも)

@syuilo
Copy link
Member

syuilo commented Jun 10, 2023

今のままでもrequestAnimationFrameとか使えば改善しないかな

@tamaina
Copy link
Contributor Author

tamaina commented Jun 10, 2023

(なんとなく変な手を加えずにsetIntervalしたほうがいい気がするんだよな…)

@tamaina
Copy link
Contributor Author

tamaina commented Jun 10, 2023

今の方式を踏襲しつつsetIntervalにするか

@tamaina
Copy link
Contributor Author

tamaina commented Jun 10, 2023

setIntervalにしてみた

@tamaina tamaina merged commit 526fa8b into develop Jul 4, 2023
@tamaina tamaina deleted the use-interval branch July 4, 2023 13:48
slofp pushed a commit to Secineralyr/misskey.dream that referenced this pull request Jul 21, 2023
misskey-dev#10981)

* perf(frontend): use setInterval instead of setTimeout chain in MkTime

* fix

* props.origin

* props.origin 2

* fix

* add comment

* setIntervalを再設定する

* refactor
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
None yet
Development

Successfully merging this pull request may close these issues.

3 participants