Przeglądaj źródła

improve performance

see https://stackoverflow.com/questions/44334233/why-is-the-stringbuilder-chaining-pattern-sb-appendx-appendy-faster-than-reg/44338950
o0lwj0o 6 lat temu
rodzic
commit
4305e9ccf8

+ 10 - 11
app/src/main/java/com/nextcloud/talk/controllers/CallController.java

@@ -1554,16 +1554,15 @@ public class CallController extends BaseController {
 
 
         StringBuilder stringBuilder = new StringBuilder();
-        stringBuilder.append("{");
-        stringBuilder.append("\"fn\":\"");
-        stringBuilder.append(StringEscapeUtils.escapeJson(LoganSquare.serialize(ncMessageWrapper
-                .getSignalingMessage()))).append("\"");
-        stringBuilder.append(",");
-        stringBuilder.append("\"sessionId\":");
-        stringBuilder.append("\"").append(StringEscapeUtils.escapeJson(callSession)).append("\"");
-        stringBuilder.append(",");
-        stringBuilder.append("\"ev\":\"message\"");
-        stringBuilder.append("}");
+        stringBuilder.append("{")
+                     .append("\"fn\":\"")
+                     .append(StringEscapeUtils.escapeJson(LoganSquare.serialize(ncMessageWrapper.getSignalingMessage()))).append("\"")
+                     .append(",")
+                     .append("\"sessionId\":")
+                     .append("\"").append(StringEscapeUtils.escapeJson(callSession)).append("\"")
+                     .append(",")
+                     .append("\"ev\":\"message\"")
+                     .append("}");
 
         List<String> strings = new ArrayList<>();
         String stringToSend = stringBuilder.toString();
@@ -1771,4 +1770,4 @@ public class CallController extends BaseController {
             showCallControls();
         }
     }
-}
+}