feat(benchmark): add comprehensive performance benchmarking system

🚀 Phase 8.2 PoC2 Achievement: 280x WASM performance boost proven\!

## New Features:
- Complete benchmark framework (src/benchmarks.rs)
- CLI integration: --benchmark --iterations options
- 3-backend comparison: Interpreter/VM/WASM
- Automated performance measurement & reporting

## Benchmark Results (100 iterations average):
- WASM: 0.17ms (280x faster than Interpreter\!)
- VM: 16.97ms (2.9x faster than Interpreter)
- Interpreter: 48.59ms (baseline)

## Added Files:
- benchmarks/bench_{light,medium,heavy}.nyash - Test cases
- benchmark_summary_20250814.md - Clean results
- wasm_demo/ - Browser execution environment

## Documentation Updates:
- docs/execution-backends.md - Added benchmark usage
- docs/CURRENT_TASK.md - Phase 8.3 Copilot coordination
- CLAUDE.md - Quick benchmark access

## Copilot Integration Ready:
- Phase 8.3 merge conflict avoidance strategy documented
- Benchmark framework ready for Box operation performance validation
- CLI integration preserved for future enhancements

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-14 07:19:23 +09:00
parent 2c485c9444
commit 8ec80a35c3
23 changed files with 1810 additions and 41 deletions

View File

@ -54,6 +54,18 @@ nyash --compile-wasm program.nyash -o output.wat
nyash --compile-wasm program.nyash -o public/app.wat
```
### ⚡ ベンチマーク(パフォーマンス測定)
```bash
# 全バックエンド性能比較デフォルト5回実行
nyash --benchmark
# 実行回数指定(統計精度向上)
nyash --benchmark --iterations 100
# 結果をファイル保存
nyash --benchmark --iterations 50 > benchmark_results.txt
```
## 🎯 インタープリター(デフォルト)
### 特徴
@ -179,11 +191,38 @@ async function loadNyashWasm() {
## 📊 パフォーマンス比較
### 実行速度(概算
### 🚀 実際のベンチマーク結果2025-08-14測定
**100回実行平均:**
| Backend | Average Time | Speed Ratio | 最適用途 |
|---------|-------------|-------------|----------|
| **🌐 WASM** | **0.17ms** | **280x faster** | Web配布・高速実行 |
| **🏎️ VM** | **16.97ms** | **2.9x faster** | 本番環境・CI/CD |
| **📝 Interpreter** | **48.59ms** | **1x (baseline)** | 開発・デバッグ |
### 📈 ベンチマーク詳細
#### Light Benchmark (簡単な算術演算)
```
WASM ████████████████████ 100% (ネイティブ並み)
VM ███████████████ 75% (最適化済み)
インタープリター ████ 20% (デバッグ重視)
Interpreter: 14.85 ms (97.6x slower than WASM)
VM: 4.44 ms (29.2x slower than WASM)
WASM: 0.15 ms (baseline)
```
#### Heavy Benchmark (複雑な計算50+演算)
```
Interpreter: 84.88 ms (414.2x slower than WASM)
VM: 25.08 ms (122.4x slower than WASM)
WASM: 0.21 ms (baseline)
```
### 💡 ベンチマーク実行方法
```bash
# 現在のマシンで性能測定
nyash --benchmark --iterations 100
# 軽量テスト(開発中)
nyash --benchmark --iterations 10
```
### メモリ使用量