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>
16 lines
363 B
JavaScript
16 lines
363 B
JavaScript
// List operations benchmark
|
|
|
|
// Create array of 10000 numbers
|
|
const nums = Array.from({length: 10000}, (_, i) => i + 1);
|
|
|
|
// Map: double each number
|
|
const doubled = nums.map(x => x * 2);
|
|
|
|
// Filter: keep even numbers
|
|
const evens = doubled.filter(x => x % 4 === 0);
|
|
|
|
// Fold: sum all
|
|
const sum = evens.reduce((acc, x) => acc + x, 0);
|
|
|
|
console.log(`Sum: ${sum}`);
|