-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jq-1.6 **extremely** slow compared to 1.5 #1826
Comments
This is quadratic linking of built-ins, which is now fixed in |
Thanks. Is a stable release with the fix in sight anytime soon? |
I think this warrants a new release soon, but we'll probably wait for a few more things..net |
Ay, a few more things yet. |
The good news is that the "master" version is significantly faster than 1.6 as shown below.
|
@waldner wrote:
I would venture to guess that jq is not being used optimally :-) You might consider asking a usage question at stackoverflow.com with the jq tag. |
AFAICT the difference between jq 1.5 and jq 1.6 startup time comes down to a change in the binding strategy: 1.5 binds each builtin individually (in reverse order) only if used, while 1.6 parses a big block of builtins as a library, resolving all the symbols internally (the quadratic part). The change seems to been made to facilitate make the Meanwhile, linking was always (and is still) quadratic. |
@muhmuhten I finally got a patch working that removes unbound instructions from a sub-tree of unbound instructions, but... it didn't help much, and cannot help much for reasons noted in the PR I opened for it. A bit disappointing... |
Which opens up a new avenue for hacking around the slow startup time: if we can separate symbol resolution from parsing (just I'm not sure there are any easy ways to avoid quadratic linking within the current design, but that could go a long way toward bringing M back down to 1.5 levels. |
None of this is likely to affect any particular jq script that takes a long time, though; the impact is on shell scripts that call jq many (at least hundreds of) times. If a single run of a particular jq script used to run "very fast" but is orders-of-magnitude slower now I'd look for 9a4576e-like accidental complexity changes to builtins or primitives. (I was totally going to suspect that particular issue looking at dates before I noticed the year changed between.) |
Yes, that is indeed the case. They can probably be optimized (will look at that when I have time, I didn't write them), but the increased slowness is a thing nonetheless. I was just citing the timeouts because that's how I became aware of the change. |
@muhmuhten i am not at a computer right now, but i was thinking of having a compiler flag to delay all bindings of top-level defs when the module is a library... Then we could bind all bulletins backwards, one at a time... |
Another idea is to keep |
And what about SPLIT |
Closed by #1834. Thanks @muhmuhten! |
jq 1.6 has a severe performance regression compared to 1.5. The problem is reported [1] and fixed [2] upstream, but there are different commits and later subsequent fixes on top of them that make it cumbersome to patch specifically. Instead, bump to a recent git version. [1] jqlang/jq#1826 [2] jqlang/jq#1834 Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
In case anyone else comes across this issue, FWIW, my query was against a JSON Lines file with (I had written some Rust code to do a query, then realized I could do the same with jq, and was surprised that it was taking more than 10x longer. With the HEAD version it's only about 2x longer.) |
Sample timing test:
Scripts that used to finish very fast with jq 1.5 are now timing out with 1.6. This is under Debian stretch 9.6, with the official binaries downloaded from jq site.
The text was updated successfully, but these errors were encountered: