CodeZettaInterview Hub

Node.js · Buffers · Senior · Scenario

Scenario: concatenating many small Buffers in a hot path is slow. Fix?

Short Interview Answer

Use Buffer.concat with known length, or a streaming approach / list of chunks with final concat once.

Detailed Explanation

Repeated concat allocates repeatedly. Pre-size or stream. Profile before micro-optimizing.

Did you know this answer?