Skip to content

perf(camera): remove redundant mkdir subprocess#540

Closed
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-camera-no-mkdir-subprocess-pr
Closed

perf(camera): remove redundant mkdir subprocess#540
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-camera-no-mkdir-subprocess-pr

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Removed the redundant /bin/mkdir -p subprocess from camera capture before writing PNG bytes.
  • Added a focused camera regression script that asserts capture no longer invokes /bin/mkdir, preserves the capture save path shape, writes through fsWriteBinaryFile(savePath, bytes), and verifies the main IPC writer creates parent directories recursively before writing.

Why

  • fs-write-binary-file already owns recursive parent directory creation with fs.promises.mkdir(path.dirname(filePath), { recursive: true }).
  • Avoiding the extra subprocess removes the measured directory-step overhead: /bin/mkdir -p averaged 1.370 ms over 80 runs on the audit Mac, while in-process mkdir averaged 0.033 ms.

Compatibility impact

  • Camera captures keep the same Pictures/SuperCmd Captures/supercmd-capture-*.png path behavior.
  • Save failures still fall through the existing capture error handling.
  • No new renderer-to-main bridge or IPC contract changes.

How tested

  • node --test scripts/test-camera-capture-single-encode.mjs
  • mcp__lsp.diagnostics on src/renderer/src/CameraExtension.tsx was run; upstream main currently reports the existing setCapturePreviewClearTimerRef diagnostic unrelated to this diff.
  • ./node_modules/.bin/tsc -p tsconfig.renderer.json --noEmit was attempted; upstream main has existing renderer type errors unrelated to this diff.
  • git diff --check origin/main..HEAD

Stack validation

@JustYannicc JustYannicc changed the title [codex] perf(camera): remove redundant mkdir subprocess perf(camera): remove redundant mkdir subprocess Jul 3, 2026
@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by #556, which consolidates this AI/native media performance batch.

@JustYannicc JustYannicc closed this Jul 3, 2026
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.

1 participant