Video summary

AI-Driven Performance Optimization - Kotzilla MCP

Main summary

Key takeaways

Technology

Overview

This video is a step-by-step tutorial showing how to use Codzilla MCP Server (where MCP = Model Context Protocol, an open-source standard) to automate app performance optimization with an AI agent (demonstrated with Codex CLI, e.g., Claude/ChatGPT).

Core idea

  • The Codzilla MCP server exposes collected performance telemetry (captured during app sessions) to the AI via MCP.
  • The AI analyzes that telemetry and generates concrete code/build changes to address performance bottlenecks.
  • You create a new session and compare sessions to quantify improvements.

Setup / Workflow

  1. Create an account at console.codzilla.io.
  2. Register the application in the Codzilla console.
  3. Choose setup via MCP server (preferred vs. manual).
  4. Configure the AI assistant to use the MCP server:
    • Often involves adding an MCP URL to a JSON configuration for the AI tool.
  5. For the demonstrated AI setup (codex CLI):
    • Paste the MCP server block into global config (in config.toml under the .codex hidden folder).
  6. Use an AI prompt to authenticate Codzilla, register the app, and set up the SDK:
    • The AI reads Codzilla documentation and configures the project.
  7. The AI modifies the project by updating:
    • Gradle files (project-level and app-level plugins/dependencies)
    • Adds Codzilla JSON config
    • Modifies the Application class to enable monitoring and report generation sent to Codzilla
  8. Recommended: bump app version before launching to make session-to-session comparisons clearer.

Performance Measurement and Session Analysis

After configuration, the creator:

  • Launches the app and navigates through onboarding/authentication/dashboard screens.
  • Stops the app to generate a new Codzilla session.
  • In Codzilla, opens the sessions page and analyzes:
    • Main thread performance
    • Dependency performance (e.g., repository load times)
    • Try dependency performance

Example findings from the first run

  • Onboarding ViewModel causes approximately ~140 ms main-thread blocking.
  • PurchasesRepository loads in roughly the ~120–20 ms-ish range (described as around 100+ ms, slightly above average).
  • The key measurable UI bottleneck appears to be onboarding-related, including main-thread issues.

AI-Generated Report and Fix Recommendation

The AI report (paraphrased) argues that multiple “Code Zeala issues” are:

  • Symptoms of the same underlying problem, not separate problems.

Root cause (as identified)

  • The onboarding flow blocks the main thread (~140 ms) because its dependency graph resolves slowly.
  • Root cause: Duplicate RevenueCat configuration/initialization
    • RevenueCat is configured in more than one place:
      • In the PurchaseRepository constructor
      • In the Onboarding screen launch effect

Suggested fix approach

  • Ensure RevenueCat is initialized exactly once.
  • Remove purchase repository injection from the onboarding ViewModel.
  • Move tracking into a lighter analytics-focused dependency.
  • The video describes a two-phase strategy:
    • first apply a targeted “single-issue” fix
    • then do broader refactoring using AI

Changes the AI Implements (Highlights)

  • Removes RevenueCat initialization from the onboarding screen.
  • Refactors by introducing:
    • a Subscription Analytics interface + implementation
  • Moves subscription tracking responsibility out of the PurchaseRepository, so:
    • The Onboarding ViewModel becomes lighter
    • It no longer constructs the heavier purchase repository at startup

Verification: Session Comparison and Quantified Results

The video reruns the app to create a second session and compares it to the first:

  • Main-thread blocking from onboarding ViewModel drops from about ~140 ms to ~5 ms.
  • The report also claims:
    • Onboarding view model-related UI bottlenecks disappear
    • RevenueCat-related performance improves substantially:
      • “increase performance by 65%”

Example per-screen timing comparisons mentioned

  • Main activity: 19 ms → 13 ms (~30% faster)
  • Onboarding: 140 ms → ~5 ms
  • Authentication: remains around ~600 ms (not optimized in this fix)

The creator concludes this as a “one simple fix” that produced measurable improvement, emphasizing that MCP enables automated diagnosis, code changes, and session comparisons.


Main Speakers / Sources

  • Primary speaker: the video creator/instructor (unnamed in subtitles)
  • Tools/servers referenced:
    • Codzilla MCP Server / Codzilla Console (console.codzilla.io)
    • MCP (Model Context Protocol) (open-source standard)
    • Codex CLI (used to run the AI agent workflow)
    • RevenueCat (identified as the performance bottleneck cause in the demo)

Original video