From 94cc3a3917f086caaafa33df7cb9a21f049c025a Mon Sep 17 00:00:00 2001 From: Peter Lawrey Date: Fri, 24 Jul 2015 19:49:40 +0300 Subject: [PATCH] CHENT-49 performance tune repeated puts. --- pom.xml | 2 +- .../net/openhft/chronicle/map/VanillaChronicleMap.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 5f4b85464..7496f51e5 100755 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ net.openhft chronicle-bom - 1.5.19 + 1.5.21-SNAPSHOT pom import diff --git a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java index cc99e5e21..c079744b9 100755 --- a/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java +++ b/src/main/java/net/openhft/chronicle/map/VanillaChronicleMap.java @@ -2101,9 +2101,11 @@ class VanillaChronicleMap, KB key, long keySize, InstanceOrBytesToInstance toKey, ReadValue readValue, RV usingValue, InstanceOrBytesToInstance toValue, MultiStoreBytes entry) { + RV v = null; long valueSize = readValueSize(entry); long valuePos = entry.position(); - RV v = readValue.readValue(copies, entry, usingValue, valueSize); + if (!putReturnsNull) + v = readValue.readValue(copies, entry, usingValue, valueSize); // get callbacks if (bytesEventListener != null) { @@ -2234,7 +2236,9 @@ class VanillaChronicleMap, // todo optimize -- prevValue could be read twice if (eventListener != null && !entryIsDeleted) { entry.positionAddr(valueAddr); - prevValueInstance = readValue(copies, entry, null, prevValueSize); + prevValueInstance = null; + if (!putReturnsNull) + prevValueInstance = readValue(copies, entry, null, prevValueSize); } // putValue may relocate entry and change offset