[bisq-network/bisq] Optimize some hotspots (#3214)

Florian Reimair notifications at github.com
Fri Sep 6 09:52:42 UTC 2019


freimair commented on this pull request.

need to check if the `isDebugEnabled()` call isn't done by `log.debug("{}", a)` anyways.

> @@ -704,9 +704,10 @@ public void run() {
                     long now = System.currentTimeMillis();
                     long elapsed = now - lastReadTimeStamp;
                     if (elapsed < 10) {
-                        log.debug("We got 2 network_messages received in less than 10 ms. We set the thread to sleep " +
-                                        "for 20 ms to avoid getting flooded by our peer. lastReadTimeStamp={}, now={}, elapsed={}",
-                                lastReadTimeStamp, now, elapsed);
+                        if (log.isDebugEnabled())

I have been in the believe that this is exactly what `log.debug("{}", a)` does before the string is assembled?

> @@ -724,7 +725,8 @@ public void run() {
 
                     NetworkEnvelope networkEnvelope = networkProtoResolver.fromProto(proto);
                     lastReadTimeStamp = now;
-                    log.debug("<< Received networkEnvelope of type: " + networkEnvelope.getClass().getSimpleName());
+                    if (log.isDebugEnabled())
+                        log.debug("<< Received networkEnvelope of type: " + networkEnvelope.getClass().getSimpleName());
 

I would instead suggest:

```suggestion
log.debug("<< Received networkEnvelope of type: {}", networkEnvelope.getClass().getSimpleName());
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3214#pullrequestreview-284764230
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190906/ac050503/attachment.html>


More information about the bisq-github mailing list