Juan Hernandez has posted comments on this change.

Change subject: utils: ssh public key entry should contain new line
......................................................................


Patch Set 2: (1 inline comment)

....................................................
File 
backend/manager/modules/engineencryptutils/src/main/java/org/ovirt/engine/core/engineencryptutils/OpenSSHUtils.java
Line 116:         final StringBuilder buffer = new 
StringBuilder(SSH_RSA.length() + 1 + encoding.length() + (alias != null? 1 + 
alias.length(): 0));
String.format is at least one order of magnitude slower than plain string 
concatenation. You should try to avoid it except when there is a need to 
internationalize the code, which is not the case.

String concatenation is translated by the compiler into use of StringBuffer 
similar to what you see in this code. StringBuffer uses synchronization, which 
StringBuilder doesn't, and it isn't needed here.

All in all using StringBuilder directly as you see in this code is much faster 
than the other two alternatives.

This idea that "little things don't matter because Java is already so slow" is 
what makes Java programs so slow, not Java itself.

Please add the "+1" to the calculation of the size, that is all what is needed.

--
To view, visit http://gerrit.ovirt.org/7027
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifd202048b8efb8f081b10651c302b9da0718035c
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Doron Fediuck <dfedi...@redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to