A web-based tool for comparing algorithm performance across different input sizes and visualizing time complexity patterns.
Code Complexity Analyzer helps developers understand the practical implications of algorithmic complexity by allowing them to:
- Compare multiple algorithm implementations side-by-side
- Measure performance across various input sizes
- Visualize execution time patterns using interactive charts
- Get automated time complexity analysis
- Algorithm Comparison: Write and test multiple algorithm implementations simultaneously
- Performance Benchmarking: Measure execution time across customizable input sizes
- Visual Analysis: Interactive line charts showing runtime trends
- Complexity Detection: AI-powered analysis of algorithm time complexity
- Modern UI: Clean, responsive interface with light/dark mode support
- Node.js (v18 or higher)
- npm or yarn
- Clone the repository:
git clone https://github.com/TheCaptain1810/codecompare.git
cd code-complexity-analyzer- Install dependencies:
npm install
# or
yarn install- Create a
.envfile in the project root and add your Google AI API key:
NEXT_PUBLIC_API_KEY=your_api_key_here
- Start the development server:
npm run dev
# or
yarn dev- Open http://localhost:3000 in your browser
- Write your algorithms in the code editors, ensuring each exports a function named 'algorithm' that accepts an array input
- Enter comma-separated input sizes to test (e.g., 10,50,100,500,1000)
- Click "Run Benchmark" to execute tests across all specified input sizes
- View the results in the chart to compare performance patterns
- Check the complexity analysis for insights about each algorithm's efficiency
- Next.js - React framework
- React - UI library
- Recharts - Data visualization
- Tailwind CSS - Styling
- Shadcn UI - UI components
- Google Gemini AI - Complexity analysis
app/- Next.js application pages and layoutcomponents/- Reusable UI componentslib/- Utility functions and API integrations
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to all contributors who have helped build this tool
- Inspired by the need to visualize algorithm performance for educational purposes