Repository navigation
Curve add-ons: tối ưu hiệu năng, snap NURBS, kéo grip, giới hạn Helix/Spiral - #4
Open
vn-Jay3Designer wants to merge 8 commits into
Open
vn-Jay3Designer wants to merge 8 commits into
vn-Jay3Designer wants to merge 8 commits into
Conversation
Records the 2026-11-05 benchmark (built-in Line/Circle ~7.7-9.3x faster than the add-on through the JSON ABI, release headless, empty document) and the rule: add-ons only add what OM9 lacks; measure before an add-on replaces an existing command; follow the admin's built-in choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AChfY1X8M1iXCrsZMoDud
Before anything is sampled (preview and final shape alike), the command now estimates the points the curve needs: turns × points per turn, where points per turn ≈ 2.4·(radius/tolerance)^¼ (measured; nearly independent of the pitch, the larger radius for a spiral). Past 1000 turns or 20000 expected points it refuses and says what to change: "increase Pitch or reduce the axis length" (or "reduce Turns" when Turns was typed). The preview is checked against the final limits, so it never shows a shape that will be refused. The estimate also seeds the fit, so fewer passes. Test: radius 50 with 600 turns is refused at once (preview and finish), with the right advice for Pitch and for Turns, while 100 turns of radius 50 is made within 0.001 mm; spirals are checked by their larger radius. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AChfY1X8M1iXCrsZMoDud
package_files_match_the_menu_crates failed on main after the PR MYuitsu#3 integration; regenerated with OM9_UPDATE_PACKAGE=1 (menu slot numbers only). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AChfY1X8M1iXCrsZMoDud
Each interactive step resolved and copied the whole settings table of the package (453 specs in OM9 Matrix): ~0.38 of 0.41 ms per step. Host gains command_settings(id, command) and command_info filters first (same resolution). Selection/transform walks return at once when there is nothing to walk; a single new object is committed incrementally, as the built-in Line/Circle do. Release, medians of 40 (addon_bench): Line 2.106 -> 0.106 ms (built-in 0.093), Circle 2.148 -> 0.101 ms, hover 0.40 -> 0.02 ms; 5,000/20,000 objects now equal to built-in. Linux: physical_memory reads /proc/meminfo (Controller::new failed off Windows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AChfY1X8M1iXCrsZMoDud
- NURBS curves had no object snaps; they now give End (ends and polyline vertices), Mid, Near, Perpendicular and Intersection, culled by the control-hull box. - Intersection paired every segment of the file on each pointer move (20,000 lines: 581 ms); only segments within the snap radius can form a candidate, so only those are paired (19.8 ms, same candidates). - Grip drag: a grip under the press wins over a crossing gumball handle; the release frame takes the released pointer/snap; along-object snaps on the edited object are ignored (End/Mid still apply). The four failing chrome grip tests pass; new end-snap grip test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AChfY1X8M1iXCrsZMoDud
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AChfY1X8M1iXCrsZMoDud
- Host keeps, per installed add-on, which settings apply to each command (built once from the manifest); command_settings/command_info no longer scan the whole package table, so the cost does not grow with more menus. - Add-on steps find the picked objects through an object -> scene position table built once per published scene (validated, rebuilt on change) instead of walking every scene object on each click and pointer move. Offset on one picked line, pointer move: 20,000 objects 0.228 -> 0.060 ms (flat from 1 to 20,000 objects). New tests: selection after scene changes; bench_edit_command_with_selection (ignored). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AChfY1X8M1iXCrsZMoDud
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AChfY1X8M1iXCrsZMoDud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tóm tắt
PR này tiếp nối PR #3. Nội dung chính: xử lý việc lệnh add-on chậm hơn lệnh tích hợp (số đo admin: Line 2,371 ms so với 0,308 ms), bổ sung snap cho đường cong NURBS, sửa thao tác kéo grip và giới hạn số vòng/số điểm cho Helix/Spiral.
Hiệu năng add-on
Nguyên nhân chậm không phải JSON (mã hóa/giải mã và chạy add-on chỉ ~0,03 ms/bước) mà do host làm việc thừa ở mỗi bước:
Host::command_settings,command_info).SceneRoots(dựng một lần mỗi scene).commit_incremental_scenenhư lệnh tích hợp.Release, trung vị 40 mẫu, chạy xen kẽ, có kiểm hình và đúng 1 mục Undo (
crates/om9-app/tests/addon_bench.rs):Snap
Kéo grip (4 test trong
ui::chromeđang lỗi trên main → đều đạt)control_grip_drag_snaps_to_an_end_of_its_own_curve.Helix/Spiral
Kiểm tra số vòng (tối đa 1000) và số điểm dự kiến (tối đa 20.000, ước lượng theo bán kính và dung sai 0,0005 mm) trước cả preview lẫn lúc tạo hình. Vượt giới hạn thì báo lỗi kèm hướng dẫn: tăng Pitch / giảm chiều dài trục (hoặc giảm Turns).
Khác
physical_memoryđọc/proc/meminfotrên Linux (trước đâyController::newlỗi trên mọi máy không phải Windows).package_files_match_the_menu_crates).openmatrix9-feature-port: thêm quy tắc ưu tiên lệnh tích hợp và checklist hiệu năng cho add-on.docs/validation/2026-11-05-addon-performance.md.Kiểm thử
om9-addons.addon_session,addon_command,addon_smoke,addon_bench,grip_selection; thư viện 381 đạt. 5 test lỗi đã lỗi sẵn trên main khi chạy trên Linux (LOCALAPPDATA, không có OCCT, catalog gợi ý lệnh).tools/public_source_audit.py0 lỗi.Việc còn lại (phần lõi)
Trong file lớn, thêm 1 vật vẫn mất ~45–55 ms ở 5.000 vật và ~220–300 ms ở 20.000 vật, lệnh tích hợp cũng như add-on. Phân bổ:
register_prepared_document~46%,prepare_with_held_usage~18%,coordinator.commit~17%.