Bug 124915 - Improve string use in NavigatorBase.cpp
Summary: Improve string use in NavigatorBase.cpp
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryuan Choi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-26 21:27 PST by Ryuan Choi
Modified: 2015-09-30 23:42 PDT (History)
2 users (show)

See Also:


Attachments
Patch (2.97 KB, patch)
2013-11-26 21:38 PST, Ryuan Choi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryuan Choi 2013-11-26 21:27:27 PST
Tried to use ASCIILiteral for constant strings.
Comment 1 Ryuan Choi 2013-11-26 21:38:50 PST
Created attachment 217925 [details]
Patch
Comment 2 Ryuan Choi 2013-11-27 20:06:31 PST
Cc benjamin,

Could you take a look at this?
Comment 3 Brent Fulgham 2014-10-31 11:29:37 PDT
Comment on attachment 217925 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=217925&action=review

This patch is out of date now (we don't use DEFINE_STATIC_LOCAL anymore), but otherwise looks good. Ben?

> Source/WebCore/page/NavigatorBase.cpp:95
> +    DEFINE_STATIC_LOCAL(String, platformName, (uname(&osname) >= 0 ? String(osname.sysname) + ' ' + String(osname.machine) : String()));

I don't understand the purpose of this change. Is adding the single space more efficient in this context?
Comment 4 Ryuan Choi 2014-11-02 20:23:27 PST
Comment on attachment 217925 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=217925&action=review

Yes, this is quite old.

If this patch is still valid, I will willingly rebase it.

>> Source/WebCore/page/NavigatorBase.cpp:95
>> +    DEFINE_STATIC_LOCAL(String, platformName, (uname(&osname) >= 0 ? String(osname.sysname) + ' ' + String(osname.machine) : String()));
> 
> I don't understand the purpose of this change. Is adding the single space more efficient in this context?

I thought that single character is more efficient in string concatenation than String(" ").
If I understood correctly, StringTypeAdaper<char> will be used in that case.
Comment 5 Gyuyoung Kim 2015-09-30 23:42:35 PDT
Comment on attachment 217925 [details]
Patch

Is this patch still valid ? Anyway, cleared review? from attachment 217925 [details] so that this bug does not appear in http://webkit.org/pending-review. If you would like this patch reviewed, please attach it to a new bug (or re-open this bug before marking it for review again).