Optimisation in Map perf test.

This commit is contained in:
Peter Lawrey
2014-12-05 23:55:40 +02:00
parent 87a20b4db9
commit 345496c84d
5 changed files with 31 additions and 11 deletions
@@ -0,0 +1,17 @@
package net.openhft.chronicle.hash.replication;
import java.net.InetSocketAddress;
public class TcpInetSocketAddress extends InetSocketAddress {
private final String toString;
public TcpInetSocketAddress(String hostname, int port) {
super(hostname, port);
toString = super.toString();
}
@Override
public String toString() {
return toString;
}
}
@@ -70,8 +70,12 @@ public final class TcpTransportAndNetworkConfig implements Serializable {
throw new IllegalArgumentException("endpoint=" + endpoint
+ " can not point to the same port as the server");
}
Set<InetSocketAddress> s = new HashSet<>();
for (InetSocketAddress endpoint : endpoints) {
s.add(new TcpInetSocketAddress(endpoint.getHostName(), endpoint.getPort()));
}
return new TcpTransportAndNetworkConfig(
serverPort, unmodifiableSet(new HashSet<InetSocketAddress>(endpoints)),
serverPort, unmodifiableSet(s),
DEFAULT_PACKET_SIZE,
false, // autoReconnectedUponDroppedConnection
ThrottlingConfig.noThrottling(),
@@ -1491,7 +1491,7 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
}
private <R> R fetchObject(Class<R> rClass, final EventId eventId, K key, V... values) {
private <R> R fetchObject(Class<R> rClass, final EventId eventId, K key, V value) {
final long startTime = System.currentTimeMillis();
ThreadLocalCopies copies;
@@ -1505,9 +1505,7 @@ class StatelessChronicleMap<K, V> implements ChronicleMap<K, V>, Closeable, Clon
: writeEventAnSkip(eventId);
copies = writeKey(key);
for (V value : values) {
copies = writeValue(value, copies);
}
copies = writeValue(value, copies);
transactionId = blockingSend(sizeLocation, startTime);
} finally {
outBytesLock.unlock();
@@ -1689,9 +1689,8 @@ class VanillaChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? super KI>,
return (int) (sizeInBytes / entrySize) + 1;
}
private <KB, KBI, MKBI extends MetaBytesInterop<KB, ? super KBI>, RV>
RV acquire(
@Nullable ThreadLocalCopies copies, final @Nullable SegmentState segmentState,
<KB, KBI, MKBI extends MetaBytesInterop<KB, ? super KBI>, RV>
RV acquire(@Nullable ThreadLocalCopies copies, final @Nullable SegmentState segmentState,
MKBI metaKeyInterop, KBI keyInterop, KB key, long keySize,
InstanceOrBytesToInstance<KB, K> toKey,
ReadValue<RV> readValue, RV usingValue, InstanceOrBytesToInstance<RV, V> toValue,