We use the ArrayList just as an index holder, after which we just
extract the underlying array. The libraries by default perform a copy
and then JIT has to prove what is going on to remove that overhead.
Let's make it super-easy instead by filling the array ourselves.
Change-Id: Ib48992538b3cd8a9a0c11011fe444e24b23dc825
Signed-off-by: Robert Varga <rovarga@cisco.com>
@Override
public IdentifiableItem<?, ?> deserialize(final NodeIdentifierWithPredicates input) {
@Override
public IdentifiableItem<?, ?> deserialize(final NodeIdentifierWithPredicates input) {
- final ArrayList<Object> bindingValues = new ArrayList<>(keysInBindingOrder.size());
+ final Object[] bindingValues = new Object[keysInBindingOrder.size()];
+ int offset = 0;
+
for (final QName key : keysInBindingOrder) {
final Object yangValue = input.getKeyValues().get(key);
for (final QName key : keysInBindingOrder) {
final Object yangValue = input.getKeyValues().get(key);
- bindingValues.add(keyValueContexts.get(key).deserialize(yangValue));
+ bindingValues[offset++] = keyValueContexts.get(key).deserialize(yangValue);
}
final Identifier<?> identifier;
try {
}
final Identifier<?> identifier;
try {
- identifier = (Identifier<?>) ctorInvoker.invokeExact(ctor, bindingValues.toArray());
+ identifier = (Identifier<?>) ctorInvoker.invokeExact(ctor, bindingValues);
} catch (Throwable e) {
throw Throwables.propagate(e);
}
} catch (Throwable e) {
throw Throwables.propagate(e);
}