Skip to content

perf: テクスチャ効果の距離判定を軽くする #1257 - #1265

Merged
bflatastic merged 1 commit into
storytold:mainfrom
haranishi:perf/issue-1257-craquelure-cell-search
Oct 12, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
haranishi:perf/issue-1257-craquelure-cell-search

Conversation

@haranishi

@haranishi haranishi commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Refs #1257

報告動画で使われている Round Corners + Craquelure の再描画で、画素ごとの近傍セル探索を軽くします。最大25セルの距離を二乗で比較し、丸め誤差や同距離の境界だけ従来の hypot 比較に戻します。同じ探索を使う Mosaic Tiles と Stained Glass にも効きます。効果設定と描画画素を維持します。

Windowsでのマウス追従は未確認です。このPRは再描画の計算量を減らす変更で、イシュー全体の解消には操作確認が残ります。進捗文書にも残件を記載し、スコア・工数は据え置きました。

How it was tested

  • macOSの cargo xtask ci: 全7工程成功、5,382件成功・0件失敗・5件ignored。
  • 6,051通りの座標・点配置で、全25候補を列挙する独立した参照実装と最寄り2点が一致。負座標、セル境界、同距離、大きい座標、非有限値を含みます。既存の画素効果テストも46件成功。
  • 自作のCMYK角丸矩形を190.07%・DPI 1.5で移動して描画。3効果それぞれの1800×1500画素のRGBA出力が、mainの出力と全バイト一致しました。
  • 同じ開発ビルド・自作フィクスチャ・移動8フレームの中央値: Craquelure 152.45 → 110.38 ms、Mosaic Tiles 127.07 → 88.52 ms、Stained Glass 205.07 → 150.78 ms。高負荷の開発機での参考値です。Windowsの操作速度やアイドル時の性能を示す値ではありません。
  • 追加した手動計測 cargo test -p vectorcraft-render texture_drag_perf -- --ignored --nocapture も実行成功。変更後の別実行では114.54 / 89.96 / 155.29 msでした。各フレームで図形を移動し、静止画のキャッシュを再利用しない計測です。
  • ネイティブアプリの ui.pointer でドラッグ: 図形の位置だけが変化し、効果設定と選択は維持。1操作のUndo/Redoで文書全体が元に戻ることと、描画画像を確認しました。ui.screenshot は NoFrame のため取得できず、OSの実マウス操作・表示フレームは未検証です。
  • 5万パスの vectorcraft-cli perf を変更前後で実行。高負荷のためアイドル時の性能判定は保留です。変更後の初回は検証アプリの起動と重なり、400%ズームが20.80 msで16 ms予算を超過しました。アプリ終了後も18.58 msで予算を超過し、他9項目は予算内でした。どちらも負荷平均31.3の測定で、アイドル時の再確認は残っています。
  • コミット a9d33fc91941f9cc3b325f3ae818579c1ab2317d を指定した Linux + wasmの全CI が成功しました(全7工程、5,367件成功・0件失敗・5件ignored)。上流の Affinity 3 corpus も成功しました。

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code.
  • Clean-room: 自作フィクスチャのみを使用。Adobe製品やGPL/AGPLのコード・素材のコピーなし。
  • Every new asset has a row in ASSETS.md (新規アセットなし)。

@haranishi
haranishi marked this pull request as ready for review October 11, 2026 20:23
Copilot AI balanced review requested due to automatic review settings October 11, 2026 20:23
@haranishi

Copy link
Copy Markdown
Contributor Author

@echelon レビューをお願いします。報告動画のCraquelure付き角丸矩形を自作フィクスチャで再現し、近傍セル探索の距離計算を減らしました。3効果の画素一致、ネイティブアプリのドラッグとUndo/Redo、macOSの全7工程CIを確認済みです。Linux + wasmの同一コミットCIと上流Affinityチェックも成功したことを本文に記載しました。Windowsでの実マウス追従とアイドル時の性能確認は残るため、#1257への部分的な改善としてレビューいただきたいです。

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bflatastic
bflatastic force-pushed the perf/issue-1257-craquelure-cell-search branch from a9d33fc to d0569b7 Compare October 12, 2026 00:50
@bflatastic
bflatastic merged commit e30147d into storytold:main Oct 12, 2026
1 check passed
@bflatastic

Copy link
Copy Markdown
Member

Thanks @haranishi! Merged. It's rebased onto current main with no changes of mine, and the full local gate passed. The brute-force test compares nearest_two against all 25 candidates, ties and rounding boundaries included. Since the pixels depend only on those two points, it shows the output is unchanged.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants