WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
159789
Use emptyString() instead of "" when possible
https://bugs.webkit.org/show_bug.cgi?id=159789
Summary
Use emptyString() instead of "" when possible
Chris Dumez
Reported
2016-07-14 15:15:26 PDT
Use emptyString() instead of "" when possible to reduce String allocations.
Attachments
Patch
(22.52 KB, patch)
2016-07-14 15:23 PDT
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2016-07-14 15:23:20 PDT
Created
attachment 283691
[details]
Patch
Chris Dumez
Comment 2
2016-07-14 16:18:40 PDT
Comment on
attachment 283691
[details]
Patch Clearing flags on attachment: 283691 Committed
r203250
: <
http://trac.webkit.org/changeset/203250
>
Chris Dumez
Comment 3
2016-07-14 16:18:45 PDT
All reviewed patches have been landed. Closing bug.
Elliott Sprehn
Comment 4
2016-07-15 13:18:21 PDT
Does this actually save allocations? String("") does StringImpl::create(LChar*) which does strlen and then StringImpl::create(LChar*, unsigned) which does:
https://github.com/adobe/webkit/blob/master/Source/WTF/wtf/text/StringImpl.cpp#L255
if (!characters || !length) return empty(); I think this patch saves branches and function calls, but not allocations?
Chris Dumez
Comment 5
2016-07-15 13:19:37 PDT
(In reply to
comment #4
)
> Does this actually save allocations? String("") does > StringImpl::create(LChar*) which does strlen and then > StringImpl::create(LChar*, unsigned) which does: > >
https://github.com/adobe/webkit/blob/master/Source/WTF/wtf/text/StringImpl
. > cpp#L255 > > if (!characters || !length) > return empty(); > > I think this patch saves branches and function calls, but not allocations?
You're totally right Elliot, I did not know about this optimization in StringImpl.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug