Skip to content

size: gate process IPC properties behind proc-ipc (unpins the JSON serializer; hello −16.5 KB) - #7010

Merged
proggeramlug merged 3 commits into
mainfrom
size/proc-ipc-gate
Jul 29, 2026
Merged

size: gate process IPC properties behind proc-ipc (unpins the JSON serializer; hello −16.5 KB)#7010
proggeramlug merged 3 commits into
mainfrom
size/proc-ipc-gate

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Fifth slice. ld64 -why_live traced the JSON serializer's presence in a hello world to a surprising root:

json::stringify::stringify_object_inner → js_json_stringify
  → process::ipc::process_ipc_send_message → process_ipc_send_fn
  → process_ipc_property → native_module::vt_get_own_field

process.send JSON-serializes every IPC message, and the process-namespace property lookup is always live, so every binary carried crate::json whether or not it used IPC or JSON. (Static JSON.stringify(x) call sites are codegen intrinsics — they don't need this path.)

process_ipc_property now returns None when the new default-on proc-ipc feature is off. Detection is intentionally broad — any send/disconnect/connected/channel token enables it — because the failure mode of a miss is process.send being undefined at runtime, so the rule errs hard toward enabling.

Measured: hello world 4,245,216 → 4,228,680 (−16.5 KB).

Verification: a real parent↔child IPC probe (fork a child, child process.sends a ready message, parent replies via child.send, child echoes back with process.connected) is byte-identical to Node — this exercises the gated path end to end, in both directions. Serial runtime suite 1510/1510; both feature states compile.

Series total: 4,461,216 → 4,228,680 (−232 KB) across #6980, #6985, #7008, #7009 and this PR.

Summary by CodeRabbit

  • Performance

    • Reduced binary size for applications that do not use process IPC features.
    • IPC-related functionality is now included only when relevant process properties are used.
  • Compatibility

    • Applications using process.send, disconnect, connected, or channel continue to receive IPC support by default.
    • IPC messages continue to use JSON serialization.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 4eb012b3-a5fc-4b45-a205-9ffa41bdeee1

📥 Commits

Reviewing files that changed from the base of the PR and between 393a36a and cc6f2fe.

📒 Files selected for processing (6)
  • changelog.d/7010-proc-ipc-gate.md
  • crates/perry-runtime/Cargo.toml
  • crates/perry-runtime/src/process/ipc.rs
  • crates/perry/src/commands/compile/collect_modules/feature_detect.rs
  • crates/perry/src/commands/compile/optimized_libs/freshness.rs
  • crates/perry/src/commands/compile/types.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • crates/perry/src/commands/compile/collect_modules/feature_detect.rs
  • crates/perry-runtime/Cargo.toml
  • crates/perry/src/commands/compile/types.rs
  • crates/perry-runtime/src/process/ipc.rs

📝 Walkthrough

Walkthrough

The compiler detects process IPC token usage, propagates it through compilation and cache feature wiring, and gates runtime IPC property lookup behind proc-ipc. Runtime defaults also enable intl-locale and intl-datetime.

Changes

Process IPC feature gating

Layer / File(s) Summary
IPC usage detection and compilation state
crates/perry/src/commands/compile/types.rs, crates/perry/src/commands/compile/collect_modules/feature_detect.rs
Compilation context tracks uses_proc_ipc, initialized to false, and feature detection enables it when IPC-related tokens are found.
Runtime IPC property gate
crates/perry-runtime/Cargo.toml, crates/perry-runtime/src/process/ipc.rs
Adds the proc-ipc runtime feature, a disabled fallback lookup, and feature-gates the existing IPC property implementation.
Optimized feature and cache wiring
crates/perry/src/commands/compile/optimized_libs/freshness.rs, changelog.d/7010-proc-ipc-gate.md
Includes uses_proc_ipc in cache keys and conditionally enables perry-runtime/proc-ipc; documents the resulting behavior and binary-size measurement.

Default Intl runtime features

Layer / File(s) Summary
Default Intl feature activation
crates/perry-runtime/Cargo.toml
Adds intl-locale and intl-datetime to the runtime’s default feature set.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant FeatureDetector
  participant CompilationContext
  participant OptimizedLibraries
  participant PerryRuntime
  FeatureDetector->>CompilationContext: detect process IPC tokens
  CompilationContext->>OptimizedLibraries: pass uses_proc_ipc
  OptimizedLibraries->>PerryRuntime: enable proc-ipc conditionally
  PerryRuntime-->>CompilationContext: expose or disable IPC properties
Loading

Possibly related PRs

  • PerryTS/perry#6605: Updates the same optimized cache-key and cross-feature wiring area for another runtime feature.
  • PerryTS/perry#6985: Extends the compiler feature-detection and cache propagation pipeline with another usage-based runtime feature gate.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: gating process IPC properties behind proc-ipc with the size impact.
Description check ✅ Passed It covers the summary, concrete changes, and verification, though it is not organized into the template's requested sections.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch size/proc-ipc-gate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug
proggeramlug merged commit ca384ca into main Jul 29, 2026
6 checks passed
@proggeramlug
proggeramlug deleted the size/proc-ipc-gate branch July 29, 2026 14:48
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