Act as a Principal Software Architect and Performance Engineer.
Your task is to perform a comprehensive performance audit and refactor of this entire codebase.
Before making any changes:
-
Thoroughly analyze the architecture, code structure, dependencies, database access patterns, caching strategy, queues, API endpoints, background jobs, asset loading, and deployment configuration.
-
Identify all performance bottlenecks, including but not limited to:
- N+1 database queries
