Top
Best
New

Posted by pistolario 15 hours ago

A Faster Alternative to Jq(micahkepe.com)
348 points | 223 commentspage 3
sirfz 10 hours ago|
Nowadays I'd just use clickhouse-local / chdb / duckdb to query json files (and pretty much any standard format files)
tehnub 8 hours ago||
I've been using jj, which apparently is also faster than jq https://github.com/tidwall/jj
swah 5 hours ago|
jj was already taken by jujutsu, unfortunately.
bouk 12 hours ago||
I highly recommend anyone to look at jq's VM implementation some time, it's kind of mind-blowing how it works under the hood: https://github.com/jqlang/jq/blob/master/src/execute.c

It does some kind of stack forking which is what allows its funky syntax

functional_dev 12 hours ago||
The backtracking implementation in jq is really the secret sauce for how it handles those complex filters without getting bogged down
vbezhenar 12 hours ago||
Looks like naive implementation of homemade bytecode interpreter. What's so mind blowing about that? Maybe I missed something.
steelbrain 14 hours ago||
Surprised to see that there's no official binaries for arm64 darwin. Meaning macOS users will have to run it through the Rosetta 2 translation layer.
micahkepe 6 hours ago||
OP here: Releases have been updated! Also someone was kind enough to package it in Homebrew already :) https://github.com/micahkepe/jsongrep/pull/22
alexellisuk 9 hours ago|||
Just hit this too:

https://news.ycombinator.com/item?id=47542182

The reason I was interested, was adding the new tool to arkade (similar to Brew, but more developer/devops focused - downloads binaries)

The agent found no Arm binaries.. and it seemed like an odd miss for a core tool

https://x.com/alexellisuk/status/2037514629409112346?s=20

QuantumNomad_ 14 hours ago|||
I’d install it via cargo anyway and that would build it for arm64.

If the arm64 version was on homebrew (didn’t check if it is but assume not because it’s not mentioned on the page), I’d install it from there rather than from cargo.

I don’t really manually install binaries from GitHub, but it’s nice that the author provides binaries for several platforms for people that do like to install it that way.

maleldil 13 hours ago||
You can use cargo-binstall to retrieve Github binary releases if there are any.
baszalmstra 14 hours ago||
Really? That is your response? This is an high quality article from someone who spend a lot of time implementing a cool tool and also sharing the intricate inner workings of it. And your response is, "eh there are no official binaries for my platform". Give them some credit! Be a little more constructive!
coldtea 13 hours ago||
His response at least fits the discussion and is relevant to the tool, not generic hollier-than-thou scolding.

To address the concern, anyway, I'm sure it would soon be available in brew as an arm binary.

jrhey 3 hours ago||
Since when was jq considered slow?
luc4 11 hours ago||
Since the query compilation needs exponential time, I wonder how large the queries can be before jsongrep becomes slower than all the other tools. In that regard, I think the library could benefit from some functionality for query compilation at compile-time.
arjie 10 hours ago||
Thank you. Very cool. Going to try embedding this into my JSON viewer. One thing I’ve struggled with is that live querying in the UI is constrained by performance.
keysersoze33 14 hours ago||
I was a bit skeptical at first, but after reading more into jsongrep, it's actually very good. Only did a very quick test just now, and after stumbling over slightly different syntax to jq, am actually quite impressed. Give it a try
carlmr 14 hours ago|
What were your syntax stumbling blocks? I must be honest I've used jq enough but can never remember the syntax. It's one of the worst things about jq IMO (not the speed, even though I'm a fan of speedups). There's something ungrokkable about that syntax for me.
keysersoze33 4 hours ago||
Just the basic things, like viewing the complete json (with syntax highlighting) to then determine the filter, that is '.' becomes '**'
wolfi1 12 hours ago||
forgive me my rant, but when I see "just install it with cargo" I immediately lose interest. How many GB do I have to install just to test a little tool? sorry, not gonna do that
rswail 10 hours ago|
Just about to read, but I had to change to dark mode to be able to see the examples, which are bold white on a white background.
More comments...