misskey icon indicating copy to clipboard operation
misskey copied to clipboard

refactore: DeepClone関数をstructuredCloneに置き換え

Open Umisyo opened this issue 2 years ago • 7 comments

What

  • backendのDeepClone関数をstructuredCloneに置き換えた

Why

  • #11103

Additional info (optional)

Checklist

  • [x] 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

Umisyo avatar Jul 04 '23 11:07 Umisyo

(何らかの理由でstructuredCloneを使ってない覚えがあった)

tamaina avatar Jul 04 '23 11:07 tamaina

パフォーマンスが悪いとかだった気がする

syuilo avatar Jul 04 '23 11:07 syuilo

フロントだけの問題だったかも(IndexedDBにVue Refの値を挿入するのに使いたかったがstructuredCloneだと代用にならなかったという話)

https://github.com/misskey-dev/misskey/pull/8098#issuecomment-1114144045

tamaina avatar Jul 04 '23 11:07 tamaina

パフォーマンス

https://github.com/misskey-dev/misskey/issues/9937 どうなった?

tamaina avatar Jul 04 '23 11:07 tamaina

パフォーマンス問題はソースコードに書いてあったわね

tamaina avatar Jul 04 '23 11:07 tamaina

パフォーマンス問題はソースコードに書いてあったわね

ホントだ。見落としてました(というかファイルそのものを消すcommitも忘れていた)

https://github.com/misskey-dev/misskey/blob/61e7eb8ff1d7ef222e60b687090cca53a182efc3/packages/backend/src/misc/clone.ts#L1

Umisyo avatar Jul 04 '23 11:07 Umisyo

Codecov Report

Merging #11107 (4f2d3d4) into develop (61e7eb8) will decrease coverage by 0.30%. The diff coverage is 50.00%.

@@             Coverage Diff             @@
##           develop   #11107      +/-   ##
===========================================
- Coverage    77.48%   77.19%   -0.30%     
===========================================
  Files          909      737     -172     
  Lines        91645    70140   -21505     
  Branches      7572     7046     -526     
===========================================
- Hits         71014    54144   -16870     
+ Misses       20631    15996    -4635     
Impacted Files Coverage Δ
packages/backend/src/core/RelayService.ts 80.80% <0.00%> (-0.16%) :arrow_down:
...ackend/src/core/entities/DriveFileEntityService.ts 77.00% <100.00%> (-0.08%) :arrow_down:

... and 190 files with indirect coverage changes

codecov[bot] avatar Jul 04 '23 11:07 codecov[bot]