Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    A

    Andrew Gallant

    blog.burntsushi.net · Personal blog · on HN since 2012

    Andrew Gallant (BurntSushi) writes about Rust, regex engines, and ripgrep, his fast command line search tool.

    Visit blogHN submissions
    Languages & CompilersSystems & PerformanceOpen Source & Linux
    What HN says

    HN links it for the ripgrep benchmarks and his argument that using unwrap() in Rust is acceptable, which commenters cite in error-handling debates.

    Stats for nerds
    141HN people shared it
    53linked in comments
    3.5Kstory points
    Dec 2025last shared
    2013people per year2025

    Top posts on HN

    1. 1
      My FOSS Story
      5 people · 922 points · first shared 2020 · 200 comments on HN
    2. 2
      Ripgrep – A new command line search tool
      61 people · 846 points · first shared 2016 · 209 comments on HN
    3. 3
      Finite state machines as data structure for representing ordered sets and maps
      27 people · 496 points · first shared 2015 · 25 comments on HN
    4. 4
      A byte string library for Rust
      4 people · 288 points · first shared 2022 · 72 comments on HN
    5. 5
      Using unwrap() in Rust is okay
      4 people · 212 points · first shared 2022 · 197 comments on HN
    6. 6
      Error handling in Rust
      16 people · 191 points · first shared 2015 · 139 comments on HN
    7. 7
      Syntax extensions and regular expressions for Rust
      4 people · 169 points · first shared 2014 · 25 comments on HN
    8. 8
      Rust and CSV parsing
      3 people · 121 points · first shared 2017 · 23 comments on HN
    9. 9
      Regex Engine Internals as a Library
      7 people · 73 points · first shared 2023 · 5 comments on HN
    10. 10
      Index 1.6B Keys with Automata and Rust (2015)
      4 people · 65 points · first shared 2024 · 6 comments on HN

    What HN people wrote when they linked it

    • osiris88Dec 2025

      > I wrote about how to do error handling without libraries literally the day Rust 1.0 was published: https://burntsushi.net/rust-error-handling/
      >
      > That blog did include a recommendation for `failure` at one point, and now `anyhow`, but it's more of a footnote. The blog shows how to do error handling without any dependencies at all. You didn't have to jump on the error library treadmill. (Although I will say that `anyhow` and `thiserror` have been around for a number of years now and shows no signs of going away.)

      Thank you -- I just wanna say, I read a lot of your writing and I love your work. I'm not sure if I read that blog post so many years ago but it looks like a good overview that has aged well.

      > I happily downcast in ripgrep: https://github.com/BurntSushi/ripgrep/blob/0a88cccd5188074de...
      >
      > That also shows the utility of an error chain.

      Yeah, I mean, that looks pretty nice.

      I still think the error chain abstraction should actually be a tree.

      And I think they should never have stabilized an `std::error::Error` trait that was not in core. I think that itself was a mistake. And 8 years later we're only now maybe able to get there.

      I actually said something on a github issue about this before rust 1.0 stabilization, and that it would cause an ecosystem split with embedded, and that this really should be fixed, but my comment was not well received, and obviously didn't have much impact. I'll see if I can find it, it's on github and I remember withoutboats…

    • nextaccounticApr 2025

      The ? operator has implicit error conversion. As another user said, it usses the From trait which performs conversions between one type and another. (Note that generally in Rust type conversions don't happen implicitly and you need to call .into() -- the ? situation is an exception)

      If you want to have more finer grained control on the error conversion (the From conversion is always the same for some pair of error types) you can use map_err before calling ?, like something.map_err(|e| othererror)?

      https://doc.rust-lang.org/std/result/enum.Result.html#method.map_err

      If you are using anyhow and wants to attach a string message to the error (maybe to explain what happened to the user), you can also use .context(), also called .wrap_err() in eyre (eyre is a fork of anyhow)

      https://docs.rs/anyhow/latest/anyhow/trait.Context.html

      https://docs.rs/eyre/latest/eyre/trait.WrapErr.html

      The following article is ten years old, but was continually updated to keep it fresh and I think it does a good job explaining how error handling works in Rust:

      https://burntsushi.net/rust-error-handling/

    • luizfelbertiJul 2023

      Depends on where you draw the line of what a parser is:

      - If the parser is "the thing that comes after the lexer" then all of this is abstracted away by the lexer and you can just treat it as a span of bytes;

      - If the parser is "everything that needs to be implemented to correctly transduce the input sequence into a tree", then you need to implement this yourself or have a lexer that handles this for you, usually done by having a tiny UTF-8 codepoint recognizing FSM in your lexer (UTF-8 is a self-synchronizing code, which makes this part easier) and ignoring the existence of graphemes.

      Most people, however, shy away from implementing a parser "all the way down to the bytes" and properly handling UTF-8 as a formal language. Most lean on a lexer abstracting this away. Ditto for context-sensitivity.

      Recently Rust's regex engine underwent a major overhaul, and burntsushi wrote a blog post[0] about doing the "all the way to the bytes" thing in the new regex engine, I highly recommend the read:

      [0] https://blog.burntsushi.net/regex-internals/#nfa-optimization-minimal-utf-8-automata

    • camgunzMay 2024

      I'm referring to #2 there: "In ASCII compatible mode, Unicode character classes are not allowed."

      > Pretty much all string processing I've built up in Rust over the past ten years is based on the idea of not validating up front. It's too costly to do. There's an entire section in my blog post on bstr about this: https://blog.burntsushi.net/bstr/#motivation-based-on-perfor...

      Yeah I read it; it's very good! (like everything you write) I think you're right that you can't handwave away the validation overhead, and that in some cases it matters. I just think ripgrep is pretty niche: there's gazillions of websites out there and like, 10 greps. If you're writing a grep and you want to optimize the shit out of it, well welcome to working around not validating. Otherwise, the safety tradeoffs and weirdo lack of specification aren't worth it.

    • forgotpwd16Mar 2021

      For anyone interested there're a few such tools that are modern alternatives to traditional Unix utilities. Interestingly all written in Rust.

      grep -> ripgrep (command `rg`)
      find -> fd
      sed -> sd
      diff -> delta
      ls -> exa && lsd
      cat -> bat
      wc -> cw
      du -> dust
      ps -> procs
      top -> ytop (**edit** archived; author recommends `bottom`)

      They all offer their own modern take but I'll say the first two, which are the only ones I'm using, are the most interesting. Both ripgrep and fd offer easier usage. The ripgrep is also an ack replacement and fd can also replace parallel (even has compatible syntax). The amazing part is that both are an order of magnitude faster their counterparts. The ripgrep dev has extended analysis for how this is achieved on their blog[0].

      [0]: https://blog.burntsushi.net/ripgrep/

    • burntsushiMar 2025

      My position is articulated here, with real examples: https://burntsushi.net/unwrap/

      > Just to be clear, you are making the argument that when a library call detects an error of the form of unexpected NULL/not-NULL, that they abort immediately?

      There's no blanket answer here because your scenario isn't specific enough. Is the pointer caller provided? Is the pointer entirely an internal detail whose invariant is managed internally? Is this pointer access important for perf? Is the pointer invariant encapsulated by something else?

      Instead, I suggest showing examples of C libraries following your philosophy. Then we'll have something concrete.

      In the comment I linked, you'll noticed that I actually looked at and reviewed real code examples. Maybe you could engage with those.

    Related

    Rust Blogblog.rust-lang.org533 people

    Announcing Rust 1.0

    Rust Blog
    Company · last shared 2026
    Manish Goregaokarmanishearth.github.io97 people

    Picking Apart the Crashing iOS String

    Manish Goregaokar
    Personal · last shared 2026
    Niko Matsakissmallcultfollowing.com221 people

    Towards a Rust Foundation

    Niko Matsakis
    Personal · last shared 2026
    Nikita Popovnikic.github.io51 people

    Make LLVM Fast Again

    Nikita Popov
    Personal · last shared 2021
    Chad Austinchadaustin.me53 people

    I just wanted Emacs to look nice – Using 24-bit color in terminals

    Chad Austin
    Personal · last shared 2026
    Aria Beingessnerfaultlore.com92 people

    C isn't a programming language anymore

    Aria Beingessner
    Personal · last shared 2026
    Nick Cameronncameron.org65 people

    Rust in 2022

    Nick Cameron
    Personal · last shared 2026
    Graham Jenkinsdarkcoding.net44 people

    Facebook’s code quality problem (2015)

    Graham Jenkins
    Personal · last shared 2025