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:
46
wasm_demo/server.py
Normal file
46
wasm_demo/server.py
Normal file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Simple HTTP server for WASM demo
|
||||
Serves with proper MIME types for WASM files
|
||||
"""
|
||||
|
||||
import http.server
|
||||
import socketserver
|
||||
import os
|
||||
|
||||
class WASMHTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
def end_headers(self):
|
||||
# Add CORS headers
|
||||
self.send_header('Access-Control-Allow-Origin', '*')
|
||||
self.send_header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
|
||||
self.send_header('Access-Control-Allow-Headers', 'Content-Type')
|
||||
super().end_headers()
|
||||
|
||||
def guess_type(self, path):
|
||||
result = super().guess_type(path)
|
||||
mimetype = result[0] if result else 'text/plain'
|
||||
|
||||
# Set proper MIME types
|
||||
if path.endswith('.wasm'):
|
||||
mimetype = 'application/wasm'
|
||||
elif path.endswith('.wat'):
|
||||
mimetype = 'text/plain'
|
||||
|
||||
return mimetype
|
||||
|
||||
PORT = 8000
|
||||
DIRECTORY = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
os.chdir(DIRECTORY)
|
||||
|
||||
with socketserver.TCPServer(("", PORT), WASMHTTPRequestHandler) as httpd:
|
||||
print(f"🚀 Nyash WASM Demo Server")
|
||||
print(f"📦 Serving at http://localhost:{PORT}")
|
||||
print(f"📂 Directory: {DIRECTORY}")
|
||||
print(f"\n✨ Open http://localhost:{PORT}/index.html in your browser!")
|
||||
print(f"Press Ctrl-C to stop the server...")
|
||||
|
||||
try:
|
||||
httpd.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
print("\n👋 Server stopped.")
|
||||
Reference in New Issue
Block a user