mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Keep Date as transient field to avoid recreating a
Data object at each getDate call. Add JsonExclude to Offer.currencyCode getDate get called very often and we have > 80k objects.
This commit is contained in:
parent
9fc4f61bf6
commit
1ddde42e17
2 changed files with 8 additions and 1 deletions
|
@ -111,6 +111,7 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
||||||
|
|
||||||
// Used only as cache
|
// Used only as cache
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@JsonExclude
|
||||||
transient private String currencyCode;
|
transient private String currencyCode;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,10 @@ public final class TradeStatistics3 implements ProcessOncePersistableNetworkPayl
|
||||||
@Getter
|
@Getter
|
||||||
private final Map<String, String> extraDataMap;
|
private final Map<String, String> extraDataMap;
|
||||||
|
|
||||||
|
// We cache the date object to avoid reconstructing a new Date at each getDate call.
|
||||||
|
@JsonExclude
|
||||||
|
private transient final Date dateObj;
|
||||||
|
|
||||||
public TradeStatistics3(String currency,
|
public TradeStatistics3(String currency,
|
||||||
long price,
|
long price,
|
||||||
long amount,
|
long amount,
|
||||||
|
@ -251,6 +255,8 @@ public final class TradeStatistics3 implements ProcessOncePersistableNetworkPayl
|
||||||
this.extraDataMap = ExtraDataMapValidator.getValidatedExtraDataMap(extraDataMap);
|
this.extraDataMap = ExtraDataMapValidator.getValidatedExtraDataMap(extraDataMap);
|
||||||
|
|
||||||
this.hash = hash == null ? createHash() : hash;
|
this.hash = hash == null ? createHash() : hash;
|
||||||
|
|
||||||
|
dateObj = new Date(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] createHash() {
|
public byte[] createHash() {
|
||||||
|
@ -319,7 +325,7 @@ public final class TradeStatistics3 implements ProcessOncePersistableNetworkPayl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getDate() {
|
public Date getDate() {
|
||||||
return new Date(date);
|
return dateObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getDateAsLong() {
|
public long getDateAsLong() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue