Last active
December 26, 2015 23:39
-
-
Save eneveu/7232549 to your computer and use it in GitHub Desktop.
GWT.create() performance question:
Do I improve performances if I store the result of GWT.create() in a constant, or does the GWT compiler do that for me?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Nonnull | |
public SafeHtml decorateWithLinkIfAny(@Nullable String link, @Nonnull SafeHtml content) { | |
return link == null ? content : SAFE_HTML_TEMPLATES.link(UriUtils.fromString(link), content); | |
} | |
private static final MySafeHtmlTemplates SAFE_HTML_TEMPLATES = GWT.create(MySafeHtmlTemplates.class); | |
// vs | |
@Nonnull | |
public SafeHtml decorateWithLinkIfAny(@Nullable String link, @Nonnull SafeHtml content) { | |
MySafeHtmlTemplates templates = GWT.create(MySafeHtmlTemplates.class); | |
return link == null ? content : templates.link(UriUtils.fromString(link), content); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment