Skip to content

Commit 80fb1cf

Browse files
committed
evolve
1 parent 594720f commit 80fb1cf

File tree

50 files changed

+4248
-151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4248
-151
lines changed

module/move/unilang/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ full = [ "enabled", "on_unknown_suggest", "simd", "repl", "enhanced_repl" ]
3030
enabled = []
3131
benchmarks = [ "simd", "clap", "pico-args", "benchkit" ]
3232

33+
# WebAssembly-compatible feature set - excludes platform-specific dependencies
34+
# No enhanced REPL (rustyline/atty), no SIMD (platform detection issues), minimal dependencies
35+
wasm = [ "enabled" ]
36+
3337
# Performance optimizations - SIMD enabled by default for maximum performance
3438
# Can be disabled with: cargo build --no-default-features --features enabled
3539
# This enables:
3640
# - SIMD JSON parsing (simd-json: 4-25x faster than serde_json)
3741
# - SIMD string operations in strs_tools (memchr, aho-corasick, bytecount)
3842
# - SIMD tokenization in unilang_parser
39-
simd = [ "simd-json", "unilang_parser/simd" ] # SIMD optimizations enabled by default
43+
simd = [ "simd-json", "memchr", "bytecount", "unilang_parser/simd" ] # SIMD optimizations enabled by default
4044

4145
# REPL (Read-Eval-Print Loop) support - basic interactive shell functionality
4246
repl = []
@@ -74,6 +78,8 @@ indexmap = "2.2.6"
7478

7579
# Performance optimization dependencies
7680
simd-json = { version = "0.13", optional = true } # SIMD-optimized JSON parsing
81+
memchr = { version = "2.7", optional = true } # SIMD-optimized byte searching (6x faster than std)
82+
bytecount = { version = "0.6", optional = true } # SIMD byte counting and operations
7783

7884
# Benchmark dependencies moved to dev-dependencies to avoid production inclusion
7985
clap = { version = "4.4", optional = true }

module/move/unilang/benchmarks/comprehensive_framework_comparison.rs

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ mod tests {
913913

914914
#[ cfg( feature = "benchmarks" ) ]
915915
#[test]
916-
#[ignore = "Long running benchmark - run explicitly"]
916+
#[ignore = "Long running manual benchmark - comprehensive analysis"]
917917
fn comprehensive_framework_comparison_benchmark() {
918918
println!("🚀 Starting Comprehensive Framework Comparison Benchmark");
919919
println!("========================================================");
@@ -1516,6 +1516,77 @@ criterion_group!(benches, comprehensive_benchmark);
15161516
#[cfg(feature = "benchmarks")]
15171517
criterion_main!(benches);
15181518

1519+
/// Benchkit-compliant comprehensive framework comparison benchmark
1520+
#[ cfg( feature = "benchmarks" ) ]
1521+
#[ test ]
1522+
#[ ignore = "Benchkit integration - comprehensive framework comparison" ]
1523+
fn comprehensive_framework_comparison_benchkit()
1524+
{
1525+
use benchkit::prelude::*;
1526+
1527+
println!( "🚀 Comprehensive Framework Comparison using Benchkit" );
1528+
println!( "====================================================" );
1529+
println!( "Testing Unilang vs Clap vs Pico-Args with statistical rigor" );
1530+
1531+
// Test with smaller command counts suitable for benchkit statistical analysis
1532+
let command_counts = vec![ 10, 100, 500 ];
1533+
1534+
for &count in &command_counts
1535+
{
1536+
let cmd_display = format_command_count( count );
1537+
println!( "\n🎯 Benchmarking {} commands", cmd_display );
1538+
1539+
let comparison = ComparativeAnalysis::new( format!( "framework_comparison_{}_commands", count ) )
1540+
.algorithm( "unilang", move ||
1541+
{
1542+
let result = benchmark_unilang_comprehensive( count );
1543+
core::hint::black_box( result );
1544+
})
1545+
.algorithm( "clap", move ||
1546+
{
1547+
let result = benchmark_clap_comprehensive( count );
1548+
core::hint::black_box( result );
1549+
})
1550+
.algorithm( "pico_args", move ||
1551+
{
1552+
let result = benchmark_pico_args_comprehensive( count );
1553+
core::hint::black_box( result );
1554+
});
1555+
1556+
let report = comparison.run();
1557+
1558+
// Display results
1559+
println!( "📊 Performance Results for {} commands:", cmd_display );
1560+
for ( name, result ) in report.sorted_by_performance()
1561+
{
1562+
println!( " • {}: {:.0} ops/sec ({:.2}ms avg)",
1563+
name,
1564+
result.operations_per_second(),
1565+
result.mean_time().as_secs_f64() * 1000.0 );
1566+
}
1567+
1568+
// Display comparative analysis
1569+
if let Some( ( fastest_name, fastest_result ) ) = report.fastest()
1570+
{
1571+
println!( "🏆 Fastest: {}", fastest_name );
1572+
1573+
for ( name, result ) in report.results()
1574+
{
1575+
if name != fastest_name
1576+
{
1577+
let speedup = result.mean_time().as_nanos() as f64 / fastest_result.mean_time().as_nanos() as f64;
1578+
println!( " 📈 {} is {:.2}x faster than {}", fastest_name, speedup, name );
1579+
}
1580+
}
1581+
}
1582+
1583+
println!( "✨ Statistical analysis completed with benchkit rigor" );
1584+
}
1585+
1586+
println!( "\n🎉 Comprehensive framework comparison completed!" );
1587+
println!( "All benchmarks executed with statistical rigor via benchkit" );
1588+
}
1589+
15191590
#[cfg(not(feature = "benchmarks"))]
15201591
fn main() {
15211592
eprintln!("Error: Benchmarks not enabled!");

module/move/unilang/benchmarks/run_all_benchmarks.rs

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ mod tests {
210210
use super::*;
211211

212212
#[test]
213-
#[ignore = "Long running benchmark suite - run explicitly with: cargo test run_all_benchmarks --release --features benchmarks -- --nocapture --ignored"]
213+
#[ignore = "Long running manual benchmark suite - comprehensive orchestration with external processes"]
214214
fn run_all_benchmarks() {
215215
println!("🏁 COMPREHENSIVE BENCHMARK SUITE");
216216
println!("================================");
@@ -313,4 +313,89 @@ mod tests {
313313
println!("\n🎉 All benchmarks completed successfully!");
314314
println!("Run individual benchmarks as needed or re-run this comprehensive suite.");
315315
}
316+
317+
/// Benchkit-compliant benchmark suite orchestrator
318+
#[ cfg( feature = "benchmarks" ) ]
319+
#[ test ]
320+
#[ ignore = "Benchkit integration - comprehensive benchmark suite orchestration" ]
321+
fn run_all_benchmarks_benchkit()
322+
{
323+
use benchkit::prelude::*;
324+
325+
println!( "🏁 Benchkit Comprehensive Benchmark Suite" );
326+
println!( "=========================================" );
327+
println!( "Running core benchmark suites with statistical rigor" );
328+
329+
// Create a comprehensive benchmark suite that orchestrates multiple benchmark types
330+
let mut suite = BenchmarkSuite::new( "unilang_comprehensive_suite" );
331+
332+
println!( "\n📊 Orchestrating core benchmarks with benchkit:" );
333+
334+
// Add JSON parsing performance benchmark
335+
println!( " • SIMD JSON parsing performance" );
336+
suite.benchmark( "simd_json_parsing", ||
337+
{
338+
use unilang::simd_json_parser::SIMDJsonParser;
339+
let test_json = r#"{"test":{"nested":{"data":[1,2,3,4,5],"info":"benchkit test"}}}"#;
340+
let result = SIMDJsonParser::parse_to_serde_value( test_json ).unwrap();
341+
core::hint::black_box( result );
342+
});
343+
344+
// Add registry performance benchmark
345+
println!( " • Command registry performance" );
346+
suite.benchmark( "command_registry_performance", ||
347+
{
348+
use unilang::registry::CommandRegistry;
349+
let registry = CommandRegistry::new();
350+
let command = registry.command( ".version" );
351+
core::hint::black_box( command );
352+
});
353+
354+
// Add pipeline performance benchmark
355+
println!( " • Command pipeline performance" );
356+
suite.benchmark( "command_pipeline_performance", ||
357+
{
358+
use unilang::pipeline::Pipeline;
359+
use unilang::registry::CommandRegistry;
360+
let registry = CommandRegistry::new();
361+
let pipeline = Pipeline::new( registry );
362+
let result = pipeline.process_command_simple( ".version" );
363+
core::hint::black_box( result );
364+
});
365+
366+
// Add string interning benchmark
367+
println!( " • String interning performance" );
368+
suite.benchmark( "string_interning_performance", ||
369+
{
370+
use unilang::interner::intern;
371+
let interned = intern( "test_command_name" );
372+
core::hint::black_box( interned );
373+
});
374+
375+
println!( "\n⏱️ Running benchkit statistical analysis..." );
376+
let results = suite.run_analysis();
377+
378+
// Generate comprehensive report
379+
println!( "\n📈 Benchmark Suite Results:" );
380+
for ( name, result ) in &results.results
381+
{
382+
println!( " • {}: {:.0} ops/sec ({:.3} μs avg)",
383+
name,
384+
result.operations_per_second(),
385+
result.mean_time().as_nanos() as f64 / 1000.0 );
386+
}
387+
388+
// Performance insights
389+
println!( "\n💡 Performance Insights:" );
390+
println!( " • All core components benchmarked with statistical rigor" );
391+
println!( " • Results provide reliable performance baseline" );
392+
println!( " • Individual benchmark variations captured and measured" );
393+
394+
let report = results.generate_markdown_report();
395+
let report_content = report.generate();
396+
println!( "\n📊 Full Statistical Report:\n{report_content}" );
397+
398+
println!( "\n✅ Comprehensive benchkit suite completed successfully!" );
399+
println!( "All core unilang components measured with professional statistical rigor" );
400+
}
316401
}

module/move/unilang/benchmarks/throughput_benchmark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ mod tests
370370

371371
#[ cfg( feature = "benchmarks" ) ]
372372
#[ test ]
373-
#[ ignore = "Benchkit integration demo - run explicitly" ]
373+
#[ ignore = "Benchkit integration - comprehensive throughput analysis" ]
374374
fn benchkit_integration_demo()
375375
{
376376
run_comprehensive_benchkit_demo();
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generated WebAssembly files
2+
pkg/
3+
4+
# Node.js dependencies (if using npm for development)
5+
node_modules/
6+
7+
# Build artifacts
8+
target/
9+
10+
# IDE files
11+
.vscode/
12+
.idea/
13+
*.swp
14+
*.swo
15+
16+
# OS files
17+
.DS_Store
18+
Thumbs.db
19+
20+
# Temporary files
21+
*.tmp
22+
*.temp
23+
24+
# Logs
25+
*.log

0 commit comments

Comments
 (0)