Closed
Bug 1294616
Opened 8 years ago
Closed 8 years ago
Somewhat improve the string performance over bug 1288320
Categories
(Core :: Audio/Video: Playback, defect, P3)
Core
Audio/Video: Playback
Tracking
()
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: jwwang, Assigned: jwwang)
References
Details
Attachments
(1 file)
By defining static constexpr auto& str = "hello"; instead of static const char* const str = "hello"; The length is known at compile time and we can call EqualsLiteral() instead of EqualsASCII() to slightly improve the performance.
Assignee | ||
Updated•8 years ago
|
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Updated•8 years ago
|
Attachment #8780964 -
Flags: review?(cpearce)
Comment 3•8 years ago
|
||
mozreview-review |
Comment on attachment 8780964 [details] Bug 1294616 - Somewhat improve the string performance by defining string literals whose length is known at compile time. https://reviewboard.mozilla.org/r/71472/#review71568 ::: dom/media/eme/EMEUtils.cpp:138 (Diff revision 2) > } > > nsString > KeySystemToGMPName(const nsAString& aKeySystem) > { > - if (aKeySystem.EqualsASCII(kEMEKeySystemPrimetime)) { > + if (aKeySystem.EqualsASCII(kEMEKeySystemPrimetime.get(), I'm not super keen on having to manually pass the length and raw char pointer to this. Can you use CompareUTF8toUTF16() instead? That does a length check too.
Attachment #8780964 -
Flags: review?(cpearce) → review+
Assignee | ||
Comment 4•8 years ago
|
||
Sure. Thanks for the review!
Comment 5•8 years ago
|
||
Though, I would have thought you could use nsAString::EqualsLiteral(const char*) instead to get what you wanted?
Assignee | ||
Comment 6•8 years ago
|
||
nsAString::EqualsLiteral is less efficient for it doesn't have the length.
Assignee | ||
Comment 7•8 years ago
|
||
We have 3 strings to compare: org.w3.clearkey com.widevine.alpha com.adobe.primetime with different lengths. So the compare functions can run in constant time when length is given.
Comment hidden (mozreview-request) |
Pushed by jwwang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3d01226b50ef Somewhat improve the string performance by defining string literals whose length is known at compile time. r=cpearce
Comment 10•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3d01226b50ef
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox51:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in
before you can comment on or make changes to this bug.
Description
•