For Vercel: move heavy initialization out of the handler into module scope so it caches across warm invocations. For Supabase/Postgres: use a connection pooler (PgBouncer), direct connections cold-start slow. For function size: trim deps, the larger the function the slower the cold start.
My first request is slow because of a cold start. Stack: [Vercel functions / Supabase Postgres]. Help me move heavy initialization to module scope so it caches across warm invocations, add a connection pooler for the database, and trim function size. Show me the specific code to move.