Implementing a performant URL parser from scratch
summary
Reimplements Node.js URL state machine and parser, porting the original C++ design into Rust and WebAssembly and then into a pure JavaScript version released as github.com/anonrig/url-js. Codebase is ~2,000 lines, runs >800 benchmarks and 733 Web Platform Tests, achieving 99.9% spec compliance. Rust+Wasm prototype shows significant Wasm/encoding overhead; the JS parser is about 5–6x faster than an existing JS library but remains ~95–96% slower than the native C++ implementation.
AI-written summary · about
chapters (10)
- 0:00URL parsers and performance
- 2:24Why URL parsers matter
- 5:30URL parsing state machines
- 8:19Node.js URL parser issues
- 10:04WebAssembly vs Rust for parsing
- 13:15JavaScript for faster parsing
- 15:23Optimizing JavaScript code
- 18:34Spec compliance vs performance
- 20:21Benchmarking results
- 21:25Conclusion
related talks
28mPowering Up NodeJS Performance by Rust and WebAssembly
22mExtending JavaScript with Rust
29mNo free lunch: Limits of WASM as a bridge from Rust to JS
30mRust in the Browser for Javascripters:New Frontiers,New Possibilities
34mPractical Polyglot WebAssembly
30mImproving web app with Rust and WASM
46mA State Of WebAssembly - The Browser is now a real VM
47mRewrite the web with Rust and Web Assembly
