Skip to content
Skills Library
Programming · Building & coding

serialization-performance

/serialization-performance

Cut the CPU and bytes spent turning objects into wire or disk format by choosing the right format, reusing schemas and buffers, and avoiding copies. Use when serialization shows up in the profile, payloads are large, or encode/decode latency dominates a hot request path.

Repository
AI-SKILLS ↗
Licence
MIT
Last repository change
05.09.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 05.09.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Cut the CPU and bytes spent turning objects into wire or disk format by choosing the right format, reusing schemas and buffers, and avoiding copies. Use when serialization shows up in the profile, payloads are large, or encode/decode latency dominates a hot request path.

Original author description

Cut the CPU and bytes spent turning objects into wire or disk format by choosing the right format, reusing schemas and buffers, and avoiding copies. Use when serialization shows up in the profile, payloads are large, or encode/decode latency dominates a hot request path.

How it works

  1. Method
  2. Litmus tests
  3. Boundaries
Original SKILL.md headings · 51 lines, 412 words
SKILL.md preview
---
name: serialization-performance
description: Cut the CPU and bytes spent turning objects into wire or disk format by choosing the right format, reusing schemas and buffers, and avoiding copies. Use when serialization shows up in the profile, payloads are large, or encode/decode latency dominates a hot request path.
---

# Serialization performance

Every service that crosses a process boundary pays to encode and decode, and on
a hot path that cost can rival the work itself. JSON is readable and slow;
binary formats are fast and opaque. The wins come from choosing the format for
the job, reusing the expensive setup, and not copying bytes you could read in
place.

## Method

1. **Measure encode and decode separately.** Profile both directions on real
   payloads; decode is often the more expensive half. Confirm serialization is a
   genuine share of the request, not a rounding error you are about to
   over-engineer.
2. **Match the format to the boundary.** Human-facing or debug APIs can afford
   JSON. High-volume internal RPC wants a schema binary format: Protobuf or
   Cap'n Proto for RPC, Avro for data pipelines, MessagePack for a compact
   JSON-shaped drop-in. Pick for throughput and payload size, not familiarity.
3. **Reuse schemas, codecs, and parsers.** Compile the Protobuf descriptor, Avro
   schema, or JSON schema once and hold it; recompiling per call is pure waste.
   Reuse a configured encoder (a pooled encoder, a `TSerializer`) rather than
   constructing one per message.
4. **Reuse buffers to cut allocation.** Encode into a pooled or preallocated
   byte buffer (`sync.Pool`, a reused `bytes.Buffer`, a scratch array) so a
   high-QPS path does not allocate and free a fresh buffer per message and feed
   the collector.
5. **Read in place with zero-copy where the format allows.** Flatbuffers and
   Cap'n Proto let you access fields with no parse step; memory-mapped Arrow and
   read-only byte views avoid copying large blobs. Slice or view the underlying
   bytes instead of duplicating them into new objects.
6. **Serialize only what the consumer needs.** Trim fields the reader ignores,
   project columns for a columnar format, and stream a large collection
   record-by-record instead of building one giant in-memory document. Fewer
   bytes encoded is less CPU and less GC.

## Litmus tests

- Was the format chosen from measured throughput and size, not defaulted to
  JSON?
- Is the schema or codec compiled once and reused, not rebuilt per call?
- Does a high-QPS encoder reuse buffers instead of allocating per message?
- For large payloads, do you view bytes in place rather than copy them?

## Boundaries

This covers turning objects into bytes and back. Compressing those bytes after
encoding, and picking the codec, is compression-tradeoffs; reducing the number
of round trips that carry them is io-optimization. Schema evolution and
versioning are the format's own contract, not a performance question.

Versions

The database has no other skills named serialization-performance.

Database snapshot: 13.11.2026 · package version 865371edc1e5 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100io-optimization
    Reduce input/output cost by cutting round trips, moving fewer bytes, and turning random access into sequential access. Use when a workload is IO-bound: disk, network, or syscall overhead dominates while the CPU sits idle.
  • 100stj-serialization-optimizer
    Optimize System.Text.Json usage in .NET — source-generated contexts, options reuse, streaming, and avoiding reflection/allocation overhead. Use this skill whenever the user works with System.Text.Json, JsonSerializer, slow or allocation-heavy serialization, source generation,…
  • 100fluent-serializer
    Guidance for fluent API serialization configuration patterns in .NET. USE FOR: building configurable serialization pipelines, wrapping System.Text.Json or Newtonsoft.Json with fluent APIs, custom serialization profiles, convention-based JSON configuration, reusable serialization…
  • 100serde-code-review
    Reviews serde serialization code for derive patterns, enum representations, custom implementations, and common serialization bugs. Use when reviewing Rust code that uses serde, serde_json, toml, or any serde-based serialization format. Covers attribute macros, field renaming,…
  • 100hyperion
    Guidance for Hyperion high-performance polymorphic serializer for .NET. USE FOR: Akka.NET actor message serialization, polymorphic type handling, object graph serialization with circular references, high-throughput binary serialization, version-tolerant deserialization of actor…
  • 90kotlin-serialization-wire-contract
    Use this skill to statically review kotlinx.serialization wire-contract safety and schema evolution: encodeDefaults/explicitNulls defaults and @EncodeDefault overrides, strict-decode ignoreUnknownKeys behavior, sealed-class closed polymorphism and class-discriminator…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.