node/test/cctest
Yagiz Nizipli 04c04c8b5c
child_process: serialize advanced IPC messages natively
The `advanced` IPC serialization codec was implemented in JavaScript
(ChildProcessSerializer / ChildProcessDeserializer in
lib/internal/child_process/serialization.js). It allocated a wrapper
serializer/deserializer per message and crossed the JS/C++ boundary
several times for every message (writeHeader, writeValue, releaseBuffer,
readHeader, readValue and friends).

Move the codec into a native `ipc_serdes` binding that drives the V8
ValueSerializer/ValueDeserializer with a C++ delegate. The wire format
is preserved byte-for-byte: a big-endian uint32 length prefix followed
by the V8 payload, with ArrayBufferViews tagged as host objects so that
Node Buffers round-trip as Buffers rather than plain Uint8Arrays. The
JSON codec is left unchanged.

A cctest (test/cctest/test_node_ipc_serdes.cc) exercises the binding
directly, covering round-trips of primitives, objects, typed arrays and
Buffers (including the Buffer-vs-Uint8Array distinction) and asserting
the big-endian length-prefix framing.

Round-trip throughput
(benchmark/child_process/child-process-ipc-roundtrip):

  payload   before     after      change
  64 B      ~300k/s    ~800k/s    +166%
  1 KiB     ~272k/s    ~616k/s    +126%
  16 KiB    ~91k/s     ~120k/s    +32%
  64 KiB    ~30k/s     ~35k/s     +16%

The gain is largest for small messages, where per-message JavaScript
overhead dominated, and tapers for large messages, where the actual
serialization (already native) dominates.

Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
PR-URL: https://github.com/nodejs/node/pull/63933
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2026-06-20 16:58:11 +02:00
..
inspector test: fix small compile warning in test_network_requests_buffer.cc 2025-10-22 15:16:32 +00:00
node_test_fixture.cc build: fix pointer compression builds 2025-05-18 23:24:01 +00:00
node_test_fixture.h src: remove deprecated node::InitializeNodeWithArgs 2025-05-28 17:24:41 +00:00
test_aliased_buffer.cc
test_base64.cc
test_base_object_ptr.cc src: add BaseObjectPtr nullptr operations 2025-04-10 16:25:10 +00:00
test_cppgc.cc doc,src,test: replace use of deprecated GetIsolate 2025-10-04 18:48:35 +02:00
test_crypto_clienthello.cc
test_dataqueue.cc quic: complete the internal implementation of QUIC 2026-05-19 14:08:13 +02:00
test_diagnostics_channel.cc src: add C++ support for diagnostics channels 2026-02-26 00:48:25 +00:00
test_environment.cc src: fast path empty native immediate drain 2026-06-18 10:11:21 +02:00
test_inspector_socket.cc
test_inspector_socket_server.cc src: use ranges library (C++20) more systematically 2025-06-26 02:31:52 +00:00
test_json_utils.cc
test_linked_binding.cc node-api: use Node-API in comments 2026-01-16 16:00:54 +00:00
test_lru_cache.cc sqlite: add tagged template 2025-09-17 16:54:11 +00:00
test_node_api.cc
test_node_crypto.cc crypto: fix warnings in test_node_crypto.cc 2026-06-18 10:09:52 +02:00
test_node_crypto_env.cc
test_node_ipc_serdes.cc child_process: serialize advanced IPC messages natively 2026-06-20 16:58:11 +02:00
test_node_postmortem_metadata.cc src: make AsyncWrap subclass internal field counts explicit 2026-03-06 16:44:32 +00:00
test_node_task_runner.cc
test_path.cc
test_per_process.cc src: build v8 tick processor as built-in source text modules 2025-11-11 02:53:13 +00:00
test_platform.cc src,test: unregister the isolate after disposal and before freeing 2025-05-02 15:10:39 +02:00
test_quic_arena.cc quic: use arena allocation for packets 2026-05-05 16:19:19 +02:00
test_quic_cid.cc quic: move quic behind compile time flag 2026-01-21 17:39:28 +00:00
test_quic_error.cc quic: move quic behind compile time flag 2026-01-21 17:39:28 +00:00
test_quic_preferredaddress.cc quic: fix a handful of bugs and missing functionality 2026-03-31 09:19:44 -07:00
test_quic_tokenbucket.cc quic: cache timestamp for address lru cache 2026-05-27 11:35:47 +02:00
test_quic_tokens.cc quic: complete the internal implementation of QUIC 2026-05-19 14:08:13 +02:00
test_report.cc
test_sockaddr.cc quic: add block list support for endpoints 2026-05-27 11:35:47 +02:00
test_string_bytes.cc src: migrate WriteOneByte to WriteOneByteV2 2025-08-29 22:41:00 +00:00
test_traced_value.cc src: internalize v8::ConvertableToTraceFormat in traces 2025-08-15 16:25:08 +00:00
test_util.cc