You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by GitBox <gi...@apache.org> on 2022/05/02 19:14:51 UTC

[GitHub] [wicket] astange1 opened a new pull request, #522: Cut back slightly on some String instance creation in PageInfo and friends.

astange1 opened a new pull request, #522:
URL: https://github.com/apache/wicket/pull/522

   These are some simple improvements that reduces unneeded String allocation for some Wicket objects, and sizes a 
   StringBuilder sensibly to avoid a resize operation on every use.
   
   I'm suspect there are some other patterns like this in the code.   These are the ones that stood out in our applications.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [wicket] martin-g commented on a diff in pull request #522: Cut back slightly on some String instance creation in PageInfo and friends.

Posted by GitBox <gi...@apache.org>.
martin-g commented on code in PR #522:
URL: https://github.com/apache/wicket/pull/522#discussion_r863737201


##########
wicket-request/src/main/java/org/apache/wicket/request/mapper/info/PageComponentInfo.java:
##########
@@ -69,23 +69,18 @@ public ComponentInfo getComponentInfo()
 	@Override
 	public String toString()
 	{
-		StringBuilder result = new StringBuilder();
-		if (pageInfo != null)
-		{
-			result.append(pageInfo.toString());
-		}
+		String result = pageInfo.toString();
 		if (componentInfo != null)
 		{
-			result.append(SEPARATOR);
-			result.append(componentInfo);
+			result = result + SEPARATOR + componentInfo;

Review Comment:
   The check `if (pageInfo != null)` is no more there.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [wicket] martin-g closed pull request #522: Cut back slightly on some String instance creation in PageInfo and friends.

Posted by GitBox <gi...@apache.org>.
martin-g closed pull request #522: Cut back slightly on some String instance creation in PageInfo and friends.
URL: https://github.com/apache/wicket/pull/522


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [wicket] astange1 commented on a diff in pull request #522: Cut back slightly on some String instance creation in PageInfo and friends.

Posted by GitBox <gi...@apache.org>.
astange1 commented on code in PR #522:
URL: https://github.com/apache/wicket/pull/522#discussion_r863744998


##########
wicket-request/src/main/java/org/apache/wicket/request/mapper/info/PageComponentInfo.java:
##########
@@ -69,23 +69,18 @@ public ComponentInfo getComponentInfo()
 	@Override
 	public String toString()
 	{
-		StringBuilder result = new StringBuilder();
-		if (pageInfo != null)
-		{
-			result.append(pageInfo.toString());
-		}
+		String result = pageInfo.toString();
 		if (componentInfo != null)
 		{
-			result.append(SEPARATOR);
-			result.append(componentInfo);
+			result = result + SEPARATOR + componentInfo;

Review Comment:
   The constructor for the class ensures that this final field can not be null.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [wicket] theigl merged pull request #522: WICKET-6979 Cut back slightly on some String instance creation in PageInfo and friends.

Posted by GitBox <gi...@apache.org>.
theigl merged PR #522:
URL: https://github.com/apache/wicket/pull/522


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@wicket.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org