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

chimp1984 notifications at github.com
Fri Sep 6 10:13:17 UTC 2019


chimp1984 requested changes on this pull request.



> @@ -98,7 +98,8 @@
 
     public SettableFuture<Connection> sendMessage(@NotNull NodeAddress peersNodeAddress,
                                                   NetworkEnvelope networkEnvelope) {
-        log.debug("sendMessage: peersNodeAddress=" + peersNodeAddress + "\n\tmessage=" + Utilities.toTruncatedString(networkEnvelope));
+        if (log.isDebugEnabled())
+            log.debug("sendMessage: peersNodeAddress=" + peersNodeAddress + "\n\tmessage=" + Utilities.toTruncatedString(networkEnvelope));

We should use the {} syntax instead of +

> @@ -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 think as well that the expression is only executed if log level matches. the static string does not has much cost

> @@ -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());
 

As far I understand it does it only at debug log level

-- 
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-284774763
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190906/bbe85008/attachment.html>


More information about the bisq-github mailing list