]> granicus.if.org Git - jq/commit
Make first(g) more efficient: extract only 1 value
authorNicolas Williams <nico@cryptonector.com>
Fri, 27 Jan 2017 15:48:13 +0000 (09:48 -0600)
committerNicolas Williams <nico@cryptonector.com>
Mon, 30 Jan 2017 20:11:05 +0000 (14:11 -0600)
commit396543191cec32f69712b4364d26a0ebaa61b801
treed62f2fff5f695e25ef1d219e4958dcefbf58cacc
parente24af3c78e78a3aab05a2800d825d56f1d842b1b
Make first(g) more efficient: extract only 1 value

first(g) was extracting two values, which, if g is slow, made first(g)
slow.  And if the second extraction were to throw an error, then
first(g) would throw that error, which is clearly not the right thing to
do.  Besides that, first(g) was allocating garbage, which it no longer
does.
src/builtin.jq
tests/jq.test