jqlang / jq

Command-line JSON processor

Home Page:https://jqlang.github.io/jq/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JQ1.6 is much slower than JQ1.5

taylorwin opened this issue · comments

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

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

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 .

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.

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

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

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.

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

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

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