Optimize rendering:
Implement techniques like object pooling for frequently created objects (e.g., pellets) and use of off-screen canvases for complex, static elements.
Separate UI rendering:
Move HUD and game over screen rendering to a separate UI renderer. This would improve separation of concerns.
You also suggested the following order of implementation:
following order of implementation: