Zero-Overhead JSON Serialization in Crystal Using Compile-Time Macros
Crystal lacks runtime reflection, but compile-time macros can generate type-safe JSON serialization methods with zero runtime overhead.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Crystal lacks runtime reflection, but compile-time macros can generate type-safe JSON serialization methods with zero runtime overhead.
Crystal schedules lightweight fibers cooperatively on a single OS thread. Learn how to pass messages between fibers with Channel(T) and avoid stalling the scheduler.
Crystal's typed channels synchronize fibers with compile-time type safety, but unbuffered channels can deadlock without a matching receiver.
Crystal's ? suffix makes nilability part of the type system, turning null-reference crashes into compile-time errors. Control-flow refinement narrows types after nil checks, and &. handles optional values inline. Trade-off: nilables spread through generics, increasing verbosity.
Crystal feels like Ruby but compiles to native code. Learn how its type inference works, where annotations are required, and how to read compiler errors.
Learn how Crystal’s lightweight fibers let you write concurrent network code that looks synchronous while staying on a single OS thread.
Learn how Crystal’s lightweight fibers let you handle tens of thousands of requests per second with minimal overhead, and see a concrete example that compares fiber‑based and thread‑per‑request servers.
Learn how to implement a high-concurrency I/O service using Crystal's cooperative fibers and channels, including strategies to avoid scheduler stalls and memory leaks.
Learn how to add graceful shutdown handling to a Crystal HTTP server so it stops accepting new connections, finishes existing requests, and exits cleanly on SIGINT/SIGTERM.