Performance: Why email matters in web apps
MEDIUM IMPACT
Email handling affects backend response times and user experience during interactions like sign-up and password reset.
from threading import Thread def send_async_email(app, msg): with app.app_context(): mail.send(msg) def register_user(): user = create_user() Thread(target=send_async_email, args=(app, create_email(user.email, 'Welcome!'))).start() return 'Registration complete'
def register_user(): user = create_user() send_email(user.email, 'Welcome!') # synchronous call return 'Registration complete'
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous email sending | 0 | 0 | Blocks initial paint until server responds | [X] Bad |
| Asynchronous email sending | 0 | 0 | Allows immediate paint after server response | [OK] Good |