Parsing JSON in 500 lines of Rust
41–50 of 59 posts
Re: Parsing JSON in 500 lines of Rust
#42I have to commend on the simplicity and clarity of thought in the write up. I could see what you were up to just by a skim through it (also thanks for the ready reference)! I'm pretty sure you'd already know of this, but once you've written your own version, it might help to compare and take notes from a popular, well-established, benchmarked library: https://github.com/serde-rs/json .
It uses a very similar paradigm to what the author used in the article, and provides a lot of helper utilities. I used it to parse a (very, very small) subset of Markdown recently [3] and enjoyed the experience.
[1] https://github.com/rust-bakery/nom
[2] https://github.com/rust-bakery/nom/blob/main/examples/json.r...
Re: Parsing JSON in 500 lines of Rust
#43Re: Parsing JSON in 500 lines of Rust
#44- is this hard to do in 500 lines of rust? - is there a catch why a implementation in rust worth mentioning on HN?
don't get me wrong im realy intested in rust.
Re: Parsing JSON in 500 lines of Rust
#45I have no rust knowledge let me ask - is this hard to do in 500 lines of rust? - is there a catch why a implementation in rust worth mentioning on HN? don't get me wrong im realy intested in rust.
Re: Parsing JSON in 500 lines of Rust
#46Earlier quoted context omitted.
Another article on the front page is discussing the capabilities of AI for coding. I wonder, given a 500 line problem, can any of the current cutting edge AIs make the code obviously, dramatically better? How far can they go?
https://minimaxir.com/2025/01/write-better-code/
Re: Parsing JSON in 500 lines of Rust
#47If OP is running this on MacOS it could be due to macOS' code signing that runs the first time you run an executable.
I wouldn't think the code signing phase is run while the benchmark is running and thus affecting those numbers.
Re: Parsing JSON in 500 lines of Rust
#48I have no rust knowledge let me ask - is this hard to do in 500 lines of rust? - is there a catch why a implementation in rust worth mentioning on HN? don't get me wrong im realy intested in rust.
No, not that much. User posted mostly because he/she is learning the language.
> is there a catch why a implementation in rust worth mentioning on HN?
HN loves Rust and it is an fun opportunity to explore Rust semantics in use without going to the more complex part of the language. It belongs to the category of "cool first project", like a Sudoku solver, etc.
Re: Parsing JSON in 500 lines of Rust
#49I guess it's faster with sudo because the regular account has some resource limits, or something? Didn't mention which system is being used (Linux? macOS? Something else?) but I can't repro on my Linux system, where performance is identical: % cargo run --release [..] Parsing speed: 103761177.00 Bytes/s Parsing speed: 103.76 MB/s Parsing speed: 0.10 GB/s % doas cargo run --release [..] Parsing speed: 105401032.21 Byt…
Wild guess, but different versions of Rust for the users?
Re: Parsing JSON in 500 lines of Rust
#50I have no rust knowledge let me ask - is this hard to do in 500 lines of rust? - is there a catch why a implementation in rust worth mentioning on HN? don't get me wrong im realy intested in rust.