You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Kočí (Created JIRA)" <de...@myfaces.apache.org> on 2012/01/07 17:23:39 UTC

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

[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


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

       

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

Posted by "Leonardo Uribe (Commented) (JIRA)" <de...@myfaces.apache.org>.
    [ 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

       

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

Posted by "Leonardo Uribe (Updated) (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-3441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe updated MYFACES-3441:
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.6
                   2.0.12
         Assignee: Leonardo Uribe  (was: Martin Kočí)
           Status: Resolved  (was: Patch Available)
    
> [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: Leonardo Uribe
>            Priority: Minor
>             Fix For: 2.0.12, 2.1.6
>
>         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

       

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

Posted by "Leonardo Uribe (Commented) (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-3441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187321#comment-13187321 ] 

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

If no objections, I'll commit the proposed code soon.
                
> [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

       

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

Posted by "Leonardo Uribe (Updated) (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-3441?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe updated MYFACES-3441:
------------------------------------

    Status: Patch Available  (was: Open)
    
> [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