Open
Description
The following thread on the Clojurians Slack caught my attention https://clojurians.slack.com/archives/C04CAKAGADU/p1695973819828719
So I've been using clojure.pprint/pprint for my pretty-printing needs so far, but it's really quite slow. I can't use Fipp because I don't want to take any dependencies (and because of e.g. https://github.com/brandonbloom/fipp/issues/37), so I thought I'd have a go at making my own pretty-printer.
What I have so far is dozens, sometimes hundreds of times faster than clojure.pprint/pprint, and 12x-15x faster than fipp.edn/pprint at Fipp's own benchmark. (It also allocates 10-25x fewer bytes than clojure.pprint/pprint or fipp.edn/pprint.) The implementation (https://github.com/eerohele/tab/blob/b5f1c0dd86349d05184d59746a017d9ed27e852d/src/tab/impl/pprint.clj) is ~200 lines of code. There are some benchmark results here: https://github.com/eerohele/tab/actions/runs/6348406766/job/17244962062#step:7:365
One tradeoff is that it's not customizable like clojure.pprint or Fipp, but that's not something I really need.
Anyway, I figured I'd throw this out there in case anyone needs something like this, or if anyone has any ideas for improving the current impl.
Perhaps it's worth inlining this in Orchard, given it's both quite simple and fast.
Metadata
Metadata
Assignees
Labels
No labels