Menu

Performance — Fastify with TypeScript (part 17/18)
📰

Performance — Fastify with TypeScript (part 17/18)

DEV Community: fastify·Antonio Tripodi·7 days ago
#vEzn9tKc
#devtofastify#devto#dev#health#chapter
Long article (1996 words) — no AI summary yet.
Reading 0:00
15s threshold

Performance

Seventeenth chapter of the "Fastify with TypeScript" series. Fastify is already fast by default, but a few architectural choices make a huge difference under real-world load, and most of them are things we've already done in this series for other reasons. This chapter names them, shows what a blocked event loop looks like, and adds the one piece that is still missing: knowing when the process is in trouble.

1. Response schemas: for safety first

For years the first performance tip for Fastify was "always define a response schema", because fast-json-stringify , the library that serializes through the schema, beat JSON.stringify . JavaScript engines have moved since then: the engine's own JSON.stringify has become very fast, and with its default settings the schema-based serializer is no longer faster on objects.

Keep the response schemas anyway.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.