Performance: User registration flow
MEDIUM IMPACT
This affects the server response time and user interaction speed during registration, impacting how quickly the page loads and responds.
app.post('/register', async (req, res) => { const user = req.body; // Asynchronous password hashing const hashedPassword = await bcrypt.hash(user.password, 10); // Asynchronous database write await db.saveUser({ ...user, password: hashedPassword }); res.send('User registered'); });
app.post('/register', (req, res) => { const user = req.body; // Synchronous password hashing (blocking) const hashedPassword = bcrypt.hashSync(user.password, 10); // Synchronous database write db.saveUser({ ...user, password: hashedPassword }); res.send('User registered'); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous blocking operations | Minimal | 0 | Low | [X] Bad |
| Asynchronous non-blocking operations | Minimal | 0 | Low | [OK] Good |