Skip to content

Auto-paint repeated search is very slow for small unquantized photos (4.1.0 and 4.2.0) #103

Closed

Description

@vycdev

🤖 This was created by Codex using the GPT-6.1-Sol model on xhigh reasoning effort, during automated macOS end-to-end testing.

Environment

macOS 27.0.1 (26A434), Apple M6 Mac mini (per test host specification), arm64. Official v4.2.0 aarch64 DMG copied to /Applications; official v4.1.0 DMG installed separately after quitting 4.2.0 and backing up app data. Main/release commit: 9487475; previous: 0b843bc. Also tested production worker through tag-specific Vite servers using Playwright Chromium 148 and WebKit 26.4.

Reproduction

  1. Import an unquantized, busy, mostly green photo around 456×463. The local reproduction crops the image from a supplied Discord screenshot and normalizes its size; it contains 142,066 unique opaque RGB colors. It is an approximation, not the reporter's original image.
  2. 3D → Auto-paint. Four filaments: white #ffffff HD 0.677, black #000000 HD 0.05, green #00ff00 HD 0.885, yellow #ffff00 HD 0.556. These are uncalibrated scalar-HD estimates; the reporter's exact calibration evidence is unavailable.
  3. Pixel size 0.1, layer height 0.12, first layer 0.20 mm; Max Height 5 mm; Smooth None; Omit isolated color specks off; Enhanced on; Total repeat limit 12; separation, dithering and Flat Paint off. Balanced, Uniform, Detailed 90%.
  4. Observe Computing progress. Try Fast/Compact, repeats off, Enhanced off, and 2D quantization to 16 colors.

Expected / actual

A small-looking image should either finish in a practical time or give actionable guidance before a very expensive search. Actual: minutes of repeated scoring are possible even for a 456×463 photo, while the button shows only approximate percentage. UI stays responsive and changing settings or switching to 2D cancels the old request, but a dedicated cancel action is absent.

The original Discord report described 0% after 30 minutes and 16% after two hours on an M4 Air. That severity and a new v4.2.0 regression were not reproduced. The reconstructed workload demonstrates a substantial, pre-existing high-target-count slow path. Reverting to 4.1.0 does not remove it.

Installed desktop, diagnostics wall-clock timing

Input / settings v4.2.0 result
142,066 colors, Balanced/Detailed, repeats 12 cancelled after 61.4 s; last trace 7.50%
Same, Fast/Compact, repeats 12 cancelled after 37.3 s; last trace 17.95%
Same, Fast/Compact, repeats off complete in 11.494 s
Same, Enhanced off complete in 4.689 s
228×231, 43,203 colors, Fast/Compact/repeats12 cancelled after 50.0 s; ~64% on-screen, last trace 60.90%
456×463 after in-app K-means to 16 colors, Fast/Compact/repeats12 complete in 0.094 s

Identical worker replay, fixed seed 12345, 30-second censoring

Engine / variant v4.1.0 v4.2.0
WebKit Balanced/repeats12 3.75% at 30 s 3.65% at 30 s
WebKit Fast/Compact/repeats12 15.29% at 30 s 15.09% at 30 s
WebKit Fast/Compact/repeats0 10.825 s complete 11.625 s complete
WebKit Enhanced off 3.777 s complete 4.243 s complete
Chromium Balanced/repeats12 3.20% at 30 s 3.05% at 30 s
Chromium Fast/Compact/repeats12 12.70% at 30 s 12.70% at 30 s
Chromium Fast/Compact/repeats0 13.480 s complete 12.639 s complete
Chromium Enhanced off 3.725 s complete 3.472 s complete

Single runs, not statistical claims; progress is not a linear ETA. Desktop diagnostics add overhead. Completed same-engine no-repeat outputs have identical final-stack fingerprints across tags.

Cause and suggested direction

Cost scales with distinct target colors, not only pixels. createSequenceScorer in src/lib/optimizer.ts evaluates candidate material sequences against the entire target palette. evaluateSequenceAgainstImage / mapTargetsToPrintablePalette in src/lib/autoPaint.ts repeatedly map all targets, calculate realized CIEDE2000 errors and select the weighted tail. Repeats expand search work (the observed Balanced progress denominator is 6,004 vs 1,504 for Fast). 2D palette reduction changes the workload by orders of magnitude.

The optimizer, worker and worker hook are byte-identical between the two tags. Their Auto-paint library diff is confined to dithering target-height recovery, outside this optimizer path. No offending commit was identified because there is no material tag regression in these measurements, and this is not a WebKit-only problem.

Consider a visible high-target-count warning with a link/action to quantize in 2D, plus explicit cancellation and stage/elapsed feedback. Algorithm acceleration needs an output-preserving benchmark; silently reducing the prepared palette would change documented behavior. No speculative algorithm PR is proposed here.

Frequency, workaround, evidence

Reproduced in both installed releases and both web engines. Best measured workaround: reduce colors in 2D → Quantization Settings → Apply (start with 16–32), then use Fast with repeats off or a small budget; re-enable repeats only after checking speed. Enhanced off is fast but uses brightness-led mapping and changes color behavior.

Local evidence root: /Users/vycdev/Desktop/kromacut-e2e/. Files: perf/discord-repro.md, perf/worker-request.json, perf/compare-workers.mjs, perf/web-comparison.jsonl, perf/desktop-traces/, perf/ui-runs.jsonl. Screenshot screenshots/v420-balanced-repeat12-456-start.png shows Computing 0% and the reported settings; later timestamped samples show progress, and screenshots/v420-fast-compact-repeat12-16colors-complete.png shows the fast reduced-palette result. No screenshots are attached through gh.

Searched open and closed issues and PRs before filing. #27 concerns older mesh-build progress on a large 16-color input; #68 proposes broad experimental WASM acceleration. This report supplies a distinct Auto-paint target-count reproduction and cross-tag/engine measurements.

Activity

  1. vycdev commented on Nov 15, 2026

    @vycdev
    OwnerAuthor

    Note

    🤖 GPT-6.1-Sol responding on behalf of vycdev

    Completed in #154, merged into develop as 079083c.

    Enhanced searches now pause for guidance at 1,024 distinct target colors, with advice to quantize in 2D, disable repeats, or use Fast/Compact. Explicit Cancel/restart controls, localized documentation, and cancellation/result-equivalence regression coverage are included, along with an exact scoring optimization.

    Large unquantized repeated searches can still be expensive; the requested guidance and cancellation are implemented. Closing as completed on develop.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions