codeflash-internal/js/VSC-Extension
HeshamHM28 f909642ce1
feat: Add Line Profiler visualization to webapp (#2268)
## Summary
Adds a line-by-line performance profiler visualization to the webapp,
allowing users to compare execution times between original and optimized
code.

  ## Changes

  ### New Line Profiler View
- **`LineProfilerView.tsx`**: Side-by-side comparison component showing:
    - Line-by-line execution times with heat map visualization
    - Syntax highlighting using `prism-react-renderer`
    - Collapsible function blocks
    - Light/dark mode support
    - Heat legend (cold → hot based on % time)

- **`lineProfilerParser.ts`**: Parser utilities for line profiler data:
- `parseLineProfilerResults()` - parses markdown table output from
Python's line_profiler
- `formatTime()` - converts timer units to human-readable format (ns,
µs, ms, s)
    - `getHeatLevel()` - determines heat coloring based on % time

- **`/review-optimizations/[traceId]/profiler/page.tsx`**: New route for
the profiler view

  ### API Changes
- **`create-pr.ts`**: Adds "📊 Performance Profile" link to PR
description when profiler data exists
- **`github-app.ts`**: Removes line profiler data from metadata when PR
is closed/merged
- **`create-staging.ts`**, **`suggest-pr-changes.ts`**: Handle line
profiler data in staging
- **`staging-storage-strategy.ts`**: Interface updates for line profiler
fields

  ### Webapp Integration
- **`page.tsx`**: Added "Performance Profile" button (only visible when
profiler data exists)
- **`action.ts`**: Sends line profiler data when creating PR from webapp
  Fixes CF-1018
  


https://codeflash-ai.slack.com/files/U08MSR1UN6L/F0A9YVDJY75/screen_recording_2026-01-21_at_10.03.18___pm.mov
https://github.com/HeshamHM28/my-best-repo/pull/21

linked to https://github.com/codeflash-ai/codeflash/pull/1139

---------

Co-authored-by: Aseem Saxena <aseem.bits@gmail.com>
2026-01-28 08:36:54 -08:00
..
.vscode [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
media [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
packages Refactor optimization result properties in SidebarProvider, CommentThreadProvider, and OptimizationService 2026-01-20 01:45:53 +02:00
src feat: Add Line Profiler visualization to webapp (#2268) 2026-01-28 08:36:54 -08:00
.gitignore ignore vsxix 2025-08-20 00:50:33 +03:00
.prettierignore [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
.prettierrc prettier 2025-08-19 22:50:02 +03:00
.vscodeignore [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
ARCHITECTURE.md [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
CHANGELOG.md [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
esbuild.js [Feat] Organization (#1888) 2025-10-29 13:05:40 -07:00
eslint.config.mjs [VSC-EXT] Thought process (#1798) 2025-09-18 11:48:00 -07:00
EXTENSION_GUIDE.md [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
IMPLEMENTATION_SUMMARY.md [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
License.md [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
package-lock.json VSC version upgrade to 19 (#2128) 2025-12-23 22:21:52 +05:30
package.json [Snyk] Security upgrade diff from 8.0.2 to 8.0.3 (#2305) 2026-01-27 17:37:39 +05:30
README.md update 2025-11-13 16:44:32 -08:00
REFACTORING_SUMMARY.md [VSC] React sidebar & reduce bundle size (#1761) 2025-09-04 18:58:54 +05:30
tsconfig.json [VSC] manual patch apply and 3-way merge (LCS) & workspace state instead of ~/.config with lsp (CF-725) (#1834) 2025-10-01 13:35:32 -07:00
vsc-extension-quickstart.md prettier 2025-08-19 22:50:02 +03:00

Codeflash VS Code Extension

VS Code Marketplace License: BSL-1.1

With Codeflash, all the Python code you and your agents write can be always optimal. One-click optimization, automate optimization after every commit, and see optimization progress in real time, and more.

Codeflash does everything that an expert performance engineer would do to find optimizations. It profiles your code, generates multiple optimization ideas, generates tests, and finds the fastest code that is correct and safe to merge.

Features

  • One-Click Optimization - Find AI-generated optimizations easily with CodeLens hints
  • 📊 Real-time Progress - Track optimization progress with detailed status updates
  • Inline Optimization Suggestions - See optimization opportunities directly above function definitions
  • 🎯 Smart Function Detection - Automatically identifies optimizable Python functions
  • 🔄 Git Integration - Optimize only changed functions with "Optimize Changed Functions"
  • 🎨 Clean Interface - Keeps you in the flow, finds optimizations in the background and stays out of your way until it finds and optimization.

Requirements

  • Python 3.9+
  • Git repository (required)
  • VS Code 1.94.0+

Quick Start

  1. Install the Codeflash extension from the Extension Marketplace
  2. Follow the installation flow to initialize Codeflash
  3. Open a Python file - Codeflash activates automatically
  4. See optimize suggestions appear above optimizable functions
  5. Click to optimize or use the sidebar to manage optimizations

Usage

Inline CodeLens

 # optimize <- Click to optimize
def slow_function(data):
    result = []
    for item in data:
        if item in [1, 2, 3, 4, 5]:
            result.append(item * 2)
    return result

Key Workflow

  1. Code normally - Write and modify Python functions
  2. See suggestions - Codeflash shows optimization opportunities
  3. Optimize selectively - Choose which functions to improve
  4. Track progress - Monitor optimizations in the sidebar
  5. Review changes - View diffs and apply improvements

Documentation

📖 Complete Documentation: https://docs.codeflash.ai/

Key Resources:

Troubleshooting

Extension won't activate?

  • Ensure you've run codeflash init in your project
  • Verify Git repository exists (.git folder)
  • Check Python 3.9+ is installed and in PATH

No functions showing?

  • Open a .py file with functions
  • Wait for analysis to complete
  • Check VS Code Output → Codeflash for errors

Need help?