A comprehensive benchmarking suite that compares file I/O performance across Python, Go, and Kotlin implementations. This project provides detailed performance analysis with statistical rigor and beautiful visualizations.
- 🔄 Multi-language benchmarking: Tests Python, Go, and Kotlin I/O performance
- 📊 Multiple file sizes: Tests with 1MB, 10MB, 50MB, and 100MB files
- 📈 Statistical analysis: Multiple iterations with mean, median, min, max, and standard deviation
- 📉 Visual comparisons: Generates performance charts and graphs
- ⚡ Throughput metrics: Measures MB/s for read and write operations
- 🤖 Automated execution: Single command runs all benchmarks
- 🔧 Cross-platform: Works on macOS, Linux, and Windows
├── benchmark_runner.py # 🎯 Main benchmark orchestrator
├── quick_test.py # 🧪 Quick implementation tester
├── test_setup.py # ⚙️ Setup verification script
├── python/
│ ├── io_benchmark.py # 🐍 Python I/O implementation
│ └── io_test.py # 🐍 Python test runner
├── golang/
│ ├── main.go # 🐹 Go I/O implementation
│ └── go.mod # 🐹 Go module definition
├── kotlin/
│ └── app/
│ └── src/main/kotlin/org/example/
│ └── App.kt # 🎯 Kotlin I/O implementation
├── data/ # 📂 Test files (auto-generated)
├── results/ # 📊 Benchmark results (auto-generated)
├── Makefile # 🔨 Build and run commands
├── requirements.txt # 📦 Python dependencies
└── .gitignore # 🚫 Git ignore rules
- 🐍 Python 3.7+
- 🐹 Go 1.19+
- ☕ Java 11+ (for Kotlin)
- 🔨 Make (build automation)
-
Clone the repository
git clone https://github.com/yourusername/io-performance-comparison.git cd io-performance-comparison -
Install dependencies (creates Python virtual environment automatically)
make install-deps
💡 Note: On macOS/Linux, this automatically creates a Python virtual environment to avoid conflicts with system Python packages.
Run the complete benchmark suite:
make benchmarkTest individual implementations:
make test-individualQuick verification test:
python3 quick_test.pyRun specific language tests:
make run-python # 🐍 Python only
make run-go # 🐹 Go only
make run-kotlin # Kotlin only- Write Test: Copy a test file using 8KB buffer chunks
- Read Test: Read the copied file using 8KB buffer chunks
- 1 MB
- 10 MB
- 50 MB
- 100 MB
- Execution Time: Time taken for read/write operations
- Throughput: MB/s for each operation
- Statistical Analysis: Mean, median, min, max, standard deviation
- Relative Performance: Performance ratios compared to Go baseline
Here's what you can expect from the benchmark results:
| Language | File Size | Read (MB/s) | Write (MB/s) |
|---|---|---|---|
| Go | 100MB | 3,856 | 815 |
| Kotlin | 100MB | 4,054 | 802 |
| Python | 100MB | 4,054 | 805 |
Results may vary based on hardware and system configuration
After running benchmarks, check the results/ directory:
- 📄
benchmark_results.json: Raw benchmark data with all iterations - 📊
benchmark_summary.csv: Tabulated results with statistics - 📈
io_performance_comparison.png: Performance visualization charts
- Uses built-in
open()with binary mode - 8KB buffer size for chunked I/O
- Context managers for proper file handling
- JSON output for benchmark results
- Uses
os.Open()andos.Create() - 8KB byte slice buffer
- Proper error handling and resource cleanup
- Structured JSON output with custom types
- Uses
FileInputStream/FileOutputStream - 8KB ByteArray buffer
- Automatic resource management with
use{} - Gson for JSON serialization
Typical performance characteristics:
- Go: Generally fastest, especially for large files
- Kotlin: Close to Go performance, benefits from JVM optimizations
- Python: Slower for pure I/O, but difference narrows with larger files
Results vary based on:
- Hardware (SSD vs HDD, CPU, RAM)
- Operating system
- File system type
- System load
Edit benchmark_runner.py:
self.test_file_sizes = [1, 10, 50, 100] # File sizes in MB
self.iterations = 3 # Number of test runsUpdate buffer size in each implementation:
- Python:
chunk = f_in.read(8192) - Go:
buf := make([]byte, 8192) - Kotlin:
val buffer = ByteArray(8192)
- Missing dependencies: Run
make install-deps - Permission errors: Ensure write access to project directory
- Out of disk space: Large test files require sufficient free space
- Java/Kotlin build errors: Verify Java 11+ is installed
Remove generated files:
make cleanRemove everything including virtual environment:
make clean-allWe welcome contributions! Here's how you can help:
- 🍴 Fork the repository
- 🌿 Create a feature branch (
git checkout -b feature/amazing-feature) - ✨ Add your improvements
- New language implementations
- Performance optimizations
- Better visualizations
- Bug fixes
- 📝 Commit your changes (
git commit -m 'Add amazing feature') - 🚀 Push to the branch (
git push origin feature/amazing-feature) - 🔄 Submit a pull request
- 🦀 Rust implementation
- 🔷 C# implementation
- ☕ Java implementation
- 📊 More visualization options
- 🔧 Different I/O patterns (async, memory-mapped, etc.)
- 🧪 Additional test scenarios
MIT License - see LICENSE file for details.
- Thanks to all contributors who help improve this benchmark suite
- Inspired by the need for fair, comprehensive I/O performance comparisons
- Built with ❤️ for the developer community
⭐ If this project helped you, please give it a star!