Skip to content

Latest commit

 

History

History
226 lines (175 loc) · 7.85 KB

File metadata and controls

226 lines (175 loc) · 7.85 KB

Figra Benchmark Results

Benchmark Status Performance Minimal Dependencies

Performance test results for Figra's file analysis tool across 78 TypeScript files.


📊 Test Overview

Files Tested: 78 TypeScript files (62 examples + 16 source files)
What It Does: Maps file dependencies and creates SVG diagrams
Dependencies: Minimal external packages needed
Platform: macOS ARM64 (Apple M3 Pro, 18GB RAM)


📊 Performance Results

Overall Statistics

  • Total Files: 78 files
  • Successful Analyses: 48 files (61.5%)
  • Failed Analyses: 30 files (38.5%)
  • Total Duration: 10,083ms
  • Average Duration: 210ms per file
  • Success Rate: 61.5%

Speed Analysis

Speed Groups

  • Under 100ms: 11 files (23%)
  • 100-500ms: 37 files (77%)
  • Over 500ms: 0 files (0%)

🔗 Connection Depth Analysis

Dependency Mapping Results

  • Total Exports Found: 186 exports
  • Total Consumers Found: 125 unique consumers
  • Total Connections: 125 connections
  • Files with Connections: 48 files (100% of successful analyses)

Top 10 Most Connected Files

Rank File Connections Duration
1 examples/AuthService.ts 10 230.82ms
2 examples/UserService.ts 9 209.74ms
3 src/interfaces/index.ts 9 163.12ms
4 src/utils/index.ts 4 134.52ms
5 examples/folder1/Logger.ts 3 213.16ms
6 examples/folder1/UserManager.ts 3 216.62ms
7 examples/folder1/ValidationUtils.ts 3 271.06ms
8 examples/folder1/deep1/DeepProcessor.ts 3 330.16ms
9 examples/folder1/deep1/DeepService.ts 3 228.72ms
10 examples/folder1/deep1/DeepUtils.ts 3 321.44ms

Connection Depth Categories

  • Shallow (1-3 connections): 44 files (92%)
  • Medium (4-10 connections): 4 files (8%)
  • Deep (>10 connections): 0 files (0%)

🏆 Fastest Files

Top 5 Fastest Files

  1. src/utils/Validator.ts - 56.31ms
  2. src/core/Parser.ts - 57.07ms
  3. src/scripts/index.ts - 57.16ms
  4. src/core/alias/resolution/tsconfig.ts - 57.29ms
  5. src/core/Resolver.ts - 57.30ms

Files with Most Relationships

  1. src/interfaces/index.ts - 26 relationships
  2. examples/AuthService.ts - 24 relationships
  3. examples/UserService.ts - 22 relationships
  4. examples/folder2/test1/deep2/ValidationEngine.ts - 14 relationships
  5. examples/folder3/test1/NetworkManager.ts - 13 relationships

❌ Error Analysis

Error Breakdown

  • No exports: 11 files (14.1%)
  • Import resolution failed: 19 files (24.4%)

Error Categories

  • No exports: Files without export statements
  • Import resolution failed: Files where import paths cannot be resolved
  • No dependencies: Files with no correlation found
  • No project root: Project root directory not found
  • Missing ripgrep: Ripgrep binary not downloaded
  • File not found: Target file doesn't exist
  • Unsupported file type: File extension not supported

📈 Key Findings

Speed Results

  1. Average Speed: 210ms per file for dependency analysis
  2. Consistent Speed: 77% of files processed in 100-500ms range
  3. Core Files Fast: Validator, Parser, Resolver all under 60ms
  4. No Slowdown: Speed stays same even with complex files

Dependency Mapping Results

  1. Good Coverage: 100% of successful tests found connections
  2. Deep Analysis: examples/AuthService.ts found 10 connections
  3. Accurate Results: 186 exports mapped to 125 consumers
  4. Visual Output: SVG diagrams created automatically

Tool Benefits

  1. Minimal Dependencies: Only 2 small packages needed
  2. Works Everywhere: macOS, Windows, Linux support
  3. Fast Search: Uses ripgrep for quick text search
  4. TypeScript Focus: Built for TS/JS projects

🔧 How Tests Were Run

Test Setup

  • Platform: macOS ARM64 (Darwin 25.0.0)
  • Hardware: Apple M3 Pro (11 cores: 5 performance + 6 efficiency)
  • Memory: 18 GB RAM
  • Node.js: v22.16.0
  • npm: 11.6.0
  • TypeScript: 5.9.2
  • Ripgrep: v14.1.1 (auto-downloaded)

What Happens During Analysis

  1. Parse File - Find exports (functions, classes, interfaces, types)
  2. Search References - Use ripgrep to find import statements
  3. Resolve Paths - Handle import paths with alias support
  4. Map Dependencies - Connect files that import from each other
  5. Create SVG - Make visual dependency diagrams

What We Measured

  • Time: How long each analysis takes
  • Exports: How many things each file exports
  • Consumers: How many files import from each file
  • Connections: Direct relationships between files
  • Success Rate: How many files analyzed successfully

🚀 Running Tests

Full Test (all files)

npx tsx ./scripts/benchmark.ts

Test Single File

npx tsx ./src/index.ts "./path/to/file.ts"

📁 Important Files

Core Files

Files with Most Connections

Test Script


📋 Test Data

Results Summary

Total Files: 78
Successful: 48 (61.5%)
Failed: 30 (38.5%)
Total Duration: 10,083ms
Average Duration: 210ms
Fastest: 56.31ms (src/utils/Validator.ts)
Slowest: 428.01ms (examples/folder2/test1/deep2/ValidationEngine.ts)

Connection Statistics

Total Exports: 186
Total Consumers: 125
Total Connections: 125
Files with Connections: 48
Shallow (1-3): 44 files
Medium (4-10): 4 files
Deep (>10): 0 files

🎯 Summary

Figra shows good performance for a tool with minimal dependencies:

  • Fast Analysis: 210ms average for dependency mapping
  • Good Coverage: 100% connection detection rate
  • Visual Output: Automatic SVG generation
  • Minimal Dependencies: Only 2 small packages needed
  • Works Well: Consistent performance across all file types

Benchmark conducted on Apple M3 Pro MacBook Pro (18GB RAM) with Node.js v22.16.0
Last updated: September 23, 2025