webrev refreshed - http://cr.openjdk.java.net/~martin/webrevs/openjdk9/Vector-grow/
On Tue, Jan 26, 2016 at 4:28 AM, Remi Forax <fo...@univ-mlv.fr> wrote: > Hi Martin, > sorry for jumping on this conversation lately, > please don't be seduced by the dark side, Too late! I've already committed such changes to ArrayList.java. No one would do this sort of bytecode golf if it didn't have measurable effects on microbenchmarks. We've been asking hotspot maintainers to kill their method-bytecode-size heuristics for a long time, but still no sign of it happening. > I understand that the code is 1 byte bigger, but i think that the following > code > final int s = this.size; > Object[] elementData = this.elementData; > if (s == elementData.length) { > elementData = grow(); > } > > is more readable than > final int s; > Object[] elementData; > if ((s = size) == (elementData = this.elementData).length) > elementData = grow(); Vector.insertElementAt is not performance critical, and not near MaxInlineSize, so I did as you ask. In core libraries readability is slightly less important than performance.