Skip to content
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

JQ1.6 is much slower than JQ1.5 #2069

Closed
taylorwin opened this issue Feb 26, 2020 · 9 comments
Closed

JQ1.6 is much slower than JQ1.5 #2069

taylorwin opened this issue Feb 26, 2020 · 9 comments

Comments

@taylorwin
Copy link

Processing the same data
jq 1.6
real 0m1.957s
user 0m1.744s
sys 0m0.004s

jq 1.5
real 0m0.177s
user 0m0.012s
sys 0m0.004s

@Alanscut
Copy link
Contributor

Alanscut commented Feb 27, 2020

Hi @taylorwin , can you provide the test data and test environment?

@taylorwin
Copy link
Author

taylorwin commented Feb 28, 2020

Hi @taylorwin , can you provide the test data and test environment?

Linux VM-51-109-ubuntu 4.4.0-151-generic #178-Ubuntu SMP Tue Jun 11 08:30:22 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

image

Data provided is not convenient .

@wtlangford
Copy link
Contributor

If you're able to, would you mind pulling down master and building it using the instructions in the README? (I've copied them here for convenience)

git submodule update --init
autoreconf -fi
./configure --with-oniguruma=builtin --disable-maintainer-mode
make -j8

We've made some pretty major improvements to jq's startup time (and other things) since 1.6 was released that should significantly help, and I'd like to see if it fixes the slowdown you're seeing.

@taylorwin
Copy link
Author

If you're able to, would you mind pulling down master and building it using the instructions in the README? (I've copied them here for convenience)

git submodule update --init
autoreconf -fi
./configure --with-oniguruma=builtin --disable-maintainer-mode
make -j8

We've made some pretty major improvements to jq's startup time (and other things) since 1.6 was released that should significantly help, and I'd like to see if it fixes the slowdown you're seeing.

When will this version be released?
surprised.....

image

@diafour
Copy link

diafour commented Mar 19, 2020

Hello! Just another report from Ubuntu 16.04 LTS.

Test command:

time bash -c 'for i in `seq 1 1000` ; do echo '"'"'{"foo":"bar"}'"'"' | jq '"'"'has("bar")'"'"' > /dev/null ; done'

Results:

jq-1.5
bash -c 0,67s user 0,48s system 26% cpu 4,304 total

jq-1.6
bash -c 74,79s user 0,74s system 92% cpu 1:21,93 total

jq-1.6-119-g5b9e63e-dirty
bash -c 0,76s user 0,47s system 28% cpu 4,305 total

@tymoteuszrogalewski
Copy link

tymoteuszrogalewski commented Dec 11, 2020

I also have trouble with extremly slow jq after upgrading Ubuntu 18 to 20 (and with this...from jq 1.5.1 to 1.6)

# lsb_release -r
Release:	18.04
# jq --version
jq-1.5-1-a5b5cbe
# echo 0 | time jq
0
0.00user 0.00system 0:00.00elapsed 85%CPU (0avgtext+0avgdata 2620maxresident)k
0inputs+0outputs (0major+110minor)pagefaults 0swaps

# lsb_release -r
Release:	20.04
# jq --version
jq-1.6
# echo 0 | time jq
0
0.03user 0.00system 0:00.07elapsed 50%CPU (0avgtext+0avgdata 3484maxresident)k
0inputs+0outputs (0major+296minor)pagefaults 0swaps

Linux kernel is the same on my both Ubuntu versions to exclude eventually issues based on kernel configuration

Same issue on every upgraded machine.

Every jq command in our bash script work on Ub20 extremly slow.

@papampi
Copy link

papampi commented May 1, 2021

Isn't this issue solved yet
I have same problem,
My jq script on core i3 ubuntu 16.4 Jq-1.5 runs triple faster than it runs on core i7 10710 ubuntu 20.04 jq-1.6

Same test as @diafour

time bash -c 'for i in `seq 1 1000` ; do echo '"'"'{"foo":"bar"}'"'"' | jq '"'"'has("bar")'"'"' > /dev/null ; done'

jq-1.5 core i3:
real 0m1.990s
user 0m0.024s
sys 0m0.136s

jq-1.6 core i7
real 0m27.699s
user 0m27.340s
sys 0m0.572s

@wtlangford
Copy link
Contributor

The current master branch should run much faster than 1.6- we had some amazing work contributed to improve our link times. On my machine, your test produces roughly similar completion times between 1.5 and master. Master is still a little bit slower than 1.5, but significantly faster than 1.6 was.

I modified your test slightly to only try to measure jq's link-time performance (because that's where the cost increase from 1.5 to 1.6 was):

 % time bash -c 'for i in `seq 1 1000` ; do jq -n . > /dev/null; done' # This is master on my machine
real         5.49
user         2.56
sys          1.54
 % time bash -c 'for i in `seq 1 1000` ; do jq-1.5 -n . > /dev/null; done'
real         4.69
user         2.58
sys          1.15
 % time bash -c 'for i in `seq 1 1000` ; do jq-1.6 -n . > /dev/null; done'
real        28.18
user        24.83
sys          1.72

@emanuele6
Copy link
Member

On an old laptop, with jq 1.7:

$ time bash -c 'for i in `seq 1 1000` ; do jq -n . > /dev/null; done'

real    0m3.564s
user    0m2.007s
sys     0m1.595s

jq 1.7 has been released; closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants