-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 startup has gotten slow due to growth in builtins and linking inefficiencies #1411
Comments
Perhaps something in the JSON parser has started doing more allocations than it should. That's all I can think of right now. Thanks for this report! |
So, I ran jq 1.5 (the release branch) through callgrind, and it looks like we're spending most of our time in... For posterity, I've attached is the call graph generated by callgrind (and kcachegrind). As such, I don't think this is an issue, so much as it is more reason to actually deal with #1380. As for the extra calls to |
@wtlangford Good job. Yeah, we need to optimize binding! |
@wtlangford It would be useful to know how much more time we spend in |
It's hard to say... kcachegrind is not my favorite tool, and this is all too fast overall for something like gprof (which I'm a bit better with). Notes about these times:
This is all based off of an invocation of jq that looks like this:
Onwards to data! Almost all of our time (99.84% of the total process time) is spent in
All of the time spent in Looking at the callers of
Lots of numbers here, and I'm not sure how well I trust them, but the expectation is that spending less time binding/binding more efficiently will speed things up. |
Thanks @wtlangford, that confirms my thinking that just going from |
Thank you for this great command jq!
Recently, I have compiled jq-1.5 (master branch HEAD) on Raspberry Pi3, and found significant slow down since jq-1.4.
Here is the information I found:
jq-1.4
Note that ./configure is done without any options. Within the build directory, I did the following commands.
jq-1.5 HEAD
For 1.5, ./configure --without-oniguruma is done.
You can see the elapsed time becomes almost 1 second for this minimum JSON and 23.5 times longer than 1.4.
Here is another trace of jq-1.5.
The major difference comes from brk() system calls after
open("/root/.jq", O_RDONLY).
0.808403 and 0.389545 seconds are not taken by brk() itself as indicated by
strace -wc
These are implying something heavy going on in the user space between these system calls.
jq-1.4 does not have these brk() calls at all. The problematic part is introduced by jq-1.5.
I put strace output of jq-1.4 below after
open("/root/.jq", O_RDONLY)
.Just to make it clear, we have much free memory, so the issue is not triggered by memory shortage.
Thank you in advance!
The text was updated successfully, but these errors were encountered: