Bug 1277221 - micro-optimize gfxFT2FontList::AppendFacesFromCachedFaceList; r=jfkthame
authorNathan Froyd <froydnj@gmail.com>
Wed, 01 Jun 2016 19:19:09 -0500
changeset 340988 7d2eb6f9f3defef10fbbdcedb1a2da687a263a42
parent 340987 061b48fc0614ecc9d8f10f0e1dbf18c7be9f0202
child 340989 9f5785ece1f2ca1205396525c68408923e0333a4
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1277221
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1277221 - micro-optimize gfxFT2FontList::AppendFacesFromCachedFaceList; r=jfkthame NS_ConvertUTF16toUTF8 is actually a string class, despite sounding somewhat like a function. Therefore, constructing one and assigning it into an nsString results in needless work; we can just use the constructed string directly.
gfx/thebes/gfxFT2FontList.cpp
--- a/gfx/thebes/gfxFT2FontList.cpp
+++ b/gfx/thebes/gfxFT2FontList.cpp
@@ -802,25 +802,23 @@ gfxFT2FontList::AppendFacesFromCachedFac
     const nsCString& aFileName,
     const nsCString& aFaceList,
     StandardFile aStdFile,
     FT2FontFamily::Visibility aVisibility)
 {
     const char *beginning = aFaceList.get();
     const char *end = strchr(beginning, ',');
     while (end) {
-        nsString familyName =
-            NS_ConvertUTF8toUTF16(beginning, end - beginning);
+        NS_ConvertUTF8toUTF16 familyName(beginning, end - beginning);
         ToLowerCase(familyName);
         beginning = end + 1;
         if (!(end = strchr(beginning, ','))) {
             break;
         }
-        nsString faceName =
-            NS_ConvertUTF8toUTF16(beginning, end - beginning);
+        NS_ConvertUTF8toUTF16 faceName(beginning, end - beginning);
         beginning = end + 1;
         if (!(end = strchr(beginning, ','))) {
             break;
         }
         uint32_t index = strtoul(beginning, nullptr, 10);
         beginning = end + 1;
         if (!(end = strchr(beginning, ','))) {
             break;