You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (Commented) (JIRA)" <de...@myfaces.apache.org> on 2012/01/17 00:57:38 UTC

[jira] [Commented] (MYFACES-3441) [perf] use shared StringBuilder instance

    [ https://issues.apache.org/jira/browse/MYFACES-3441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187319#comment-13187319 ] 

Leonardo Uribe commented on MYFACES-3441:
-----------------------------------------

Attached alternate patch. The idea is create a class called SharedStringBuilder with these methods:

public static StringBuilder get(FacesContext facesContext, String stringBuilderKey)
public static StringBuilder get(FacesContext facesContext, String stringBuilderKey, int initialSize)
public static StringBuilder get(String stringBuilderKey)

and provide a param that allows to provide a key. In this way, we can reuse the same buffer, but do not mix it in different locations and cause problems that later become very difficult to solve. The idea is use it per renderer or per class.

Additionally, I propose some places where this technique becomes useful, like in ajax renderer or link calculations. I don't think we should use this everywhere, just in some selected locations and that's it. There is no appreciable difference in code speed but the memory gets some benefit, because less object instances means less gc.

                
> [perf] use shared StringBuilder instance
> ----------------------------------------
>
>                 Key: MYFACES-3441
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3441
>             Project: MyFaces Core
>          Issue Type: Improvement
>         Environment: myfaces core trunk
>            Reporter: Martin Kočí
>            Assignee: Martin Kočí
>            Priority: Minor
>         Attachments: MYFACES-3441-1.patch, RendererUtils.path
>
>
> method  javax.faces.component.UIComponentBase._getSharedStringBuilder(FacesContext) already provide this. Add same method to public API and use request-shared StringBuilder instance in renderers too.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira