Performance: ValidationPipe in depth
MEDIUM IMPACT
ValidationPipe affects the request processing speed by adding validation logic before controller handlers run, impacting interaction responsiveness.
app.useGlobalPipes(new ValidationPipe({ whitelist: true, forbidNonWhitelisted: true, transform: true }));app.useGlobalPipes(new ValidationPipe({ whitelist: false, forbidNonWhitelisted: false }));| Pattern | CPU Usage | Event Loop Blocking | Validation Depth | Verdict |
|---|---|---|---|---|
| ValidationPipe with whitelist and transform enabled | Low | Minimal | Controlled | [OK] Good |
| ValidationPipe with default settings and no whitelist | High | Moderate | Deep | [X] Bad |