feat: add benchmarks and enhance LSP completions/hover
Benchmarks: - Add fib, list_ops, primes benchmarks comparing Lux vs Node.js vs Rust - Lux matches Rust performance and is 8-30x faster than Node.js - Add docs/benchmarks.md documenting results LSP improvements: - Context-aware completions (module access vs general) - Add List, String, Option, Result, Console, Math method completions - Add type and builtin completions - Hover now shows type signatures and documentation for known symbols - Hover returns formatted markdown with code blocks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
21
benchmarks/primes.rs
Normal file
21
benchmarks/primes.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
// Prime counting benchmark - count primes up to N
|
||||
fn is_prime(n: i64) -> bool {
|
||||
if n < 2 { return false; }
|
||||
if n == 2 { return true; }
|
||||
if n % 2 == 0 { return false; }
|
||||
let mut i = 3i64;
|
||||
while i * i <= n {
|
||||
if n % i == 0 { return false; }
|
||||
i += 2;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn count_primes(n: i64) -> i64 {
|
||||
(2..=n).filter(|&x| is_prime(x)).count() as i64
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let count = count_primes(10000);
|
||||
println!("Primes up to 10000: {}", count);
|
||||
}
|
||||
Reference in New Issue
Block a user