You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2016/11/08 15:13:58 UTC

[jira] [Commented] (LOG4J2-1684) (GC) Avoid allocating temporary objects in StructuredDataMessage

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

Remko Popma commented on LOG4J2-1684:
-------------------------------------

Commit 0413ea6 lets both StructuredDataMessage and StructuredDataId implement StringBuilderFormattable.

Still need to understand why StructuredDataMessage::asString (line 298) needs to call StructuredDataId::makeId.
Can't this line
{code}
sdId = sdId.makeId(structuredDataId);
{code}
be replaced by the below?
{code}
sdId = structuredDataId == null ? sdId : structuredDataId;
{code}
(Especially since the only use for the {{sdId}} object is to render it to text it seems unnecessary to potentially create a new instance.)

> (GC) Avoid allocating temporary objects in StructuredDataMessage
> ----------------------------------------------------------------
>
>                 Key: LOG4J2-1684
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1684
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.7
>            Reporter: Remko Popma
>
> Make StructuredDataMessage garbage-free.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org