You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Robert Munteanu (JIRA)" <ji...@apache.org> on 2015/03/27 13:47:52 UTC
[jira] [Commented] (SLING-4544) Performance: MessageFormat
shouldn't be used for logging in SlingRequestProgressTracker
[ https://issues.apache.org/jira/browse/SLING-4544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14383781#comment-14383781 ]
Robert Munteanu commented on SLING-4544:
----------------------------------------
Well, the problem with that is we have a
{code:java}public void log(String format, Object... args) {
String message = MessageFormat.format(format, args);
entries.add(new TrackingEntry(LOG_PREFIX + message));
}{code}
method which expects a MessageFormat format string as an argument. What I think can work around the issue though is to not eagerly apply the formatting when the {{log}} method is invoked, but rather do it lazily when the {{getMessages()}} method is called.
[~joelrich] - if you can submit a patch I will be happy to review and apply.
> Performance: MessageFormat shouldn't be used for logging in SlingRequestProgressTracker
> ---------------------------------------------------------------------------------------
>
> Key: SLING-4544
> URL: https://issues.apache.org/jira/browse/SLING-4544
> Project: Sling
> Issue Type: Improvement
> Components: Engine
> Affects Versions: Engine 2.4.0
> Reporter: Joel Richard
> Labels: performance
> Attachments: Screen Shot 2015-03-25 at 10.42.05.png
>
>
> I am profiling an application where up to 5% of the rendering time is spent in MessageFormat.format for SlingRequestProgressTracker.log (see attached screenshot). Since the advanced capabilities of MessageFormat are not required here, it should be rather easy to implement a utility which supports \{x} as well but is much faster.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)