3a7a218e8f
Adds support for indexing into lists and arrays with negative indexes meaning "counting from the back". So for if `x = ["cat", "dog", "chicken"]` then `x[-1] == "chicken"`. This adds an extra branch to every array and list access but some performance testing makes it look like the branch predictor successfully predicts the branch every time so there isn't a in execution time for this feature when the index is positive. When the index is negative performance testing showed the runtime is the same as writing `x[x.length - 1]`, again, presumably thanks to the branch predictor. Those performance metrics were calculated for lists and arrays but `def`s get roughly the same treatment though instead of inlining the test they need to make a invoke dynamic so we don't screw up maps. Closes #20870 |
||
---|---|---|
.. | ||
advanced-scripting.asciidoc | ||
expression.asciidoc | ||
fields.asciidoc | ||
groovy.asciidoc | ||
native.asciidoc | ||
painless-syntax.asciidoc | ||
painless.asciidoc | ||
security.asciidoc | ||
using.asciidoc |