Bug 1425700 - Add a parsing benchmarks with use counters. r=bholley
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 20 Aug 2018 23:38:15 +0200
changeset 488737 42822c922dcfd2664b3a5d357a6b8d1f792c5d85
parent 488736 bc3f9356906bd462f3941e2ec6510a145aa65b2d
child 488738 d5203d9dc33b2f829f621c30e99dbfa5a4bed32c
push id9734
push usershindli@mozilla.com
push dateThu, 30 Aug 2018 12:18:07 +0000
treeherdermozilla-beta@71c71ab3afae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1425700
milestone63.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 1425700 - Add a parsing benchmarks with use counters. r=bholley That way we have a simple baseline to measure overhead. Differential Revision: https://phabricator.services.mozilla.com/D3839
layout/style/test/gtest/StyloParsingBench.cpp
--- a/layout/style/test/gtest/StyloParsingBench.cpp
+++ b/layout/style/test/gtest/StyloParsingBench.cpp
@@ -19,17 +19,17 @@ using namespace mozilla::net;
 
 // Bug 1436018 - Disable Stylo microbenchmark on Windows
 #if !defined(_WIN32) && !defined(_WIN64)
 
 #define PARSING_REPETITIONS 20
 #define SETPROPERTY_REPETITIONS (1000 * 1000)
 #define GETPROPERTY_REPETITIONS (1000 * 1000)
 
-static void ServoParsingBench()
+static void ServoParsingBench(const StyleUseCounters* aCounters)
 {
   auto css = AsBytes(MakeStringSpan(EXAMPLE_STYLESHEET));
   nsCString cssStr;
   cssStr.Append(css);
   ASSERT_EQ(Encoding::UTF8ValidUpTo(css), css.Length());
 
   RefPtr<URLExtraData> data = new URLExtraData(
     NullPrincipalURI::Create(), nullptr, NullPrincipal::CreateWithoutOriginAttributes());
@@ -39,17 +39,17 @@ static void ServoParsingBench()
                                      nullptr,
                                      nullptr,
                                      &cssStr,
                                      eAuthorSheetFeatures,
                                      data,
                                      0,
                                      eCompatibility_FullStandards,
                                      nullptr,
-                                     nullptr)
+                                     aCounters)
         .Consume();
   }
 }
 
 static void ServoSetPropertyByIdBench(const nsACString& css)
 {
   RefPtr<RawServoDeclarationBlock> block = Servo_DeclarationBlock_CreateEmpty().Consume();
   RefPtr<URLExtraData> data = new URLExtraData(
@@ -97,17 +97,24 @@ static void ServoGetPropertyValueById() 
       block,
       eCSSProperty_width,
       &value
     );
     ASSERT_TRUE(value.EqualsLiteral("10px"));
   }
 }
 
-MOZ_GTEST_BENCH(Stylo, Servo_StyleSheet_FromUTF8Bytes_Bench, ServoParsingBench);
+MOZ_GTEST_BENCH(Stylo, Servo_StyleSheet_FromUTF8Bytes_Bench, [] {
+    ServoParsingBench(nullptr);
+});
+
+MOZ_GTEST_BENCH(Stylo, Servo_StyleSheet_FromUTF8Bytes_Bench_UseCounters, [] {
+    RefPtr<StyleUseCounters> counters = Servo_UseCounters_Create().Consume();
+    ServoParsingBench(counters);
+});
 
 MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_SetPropertyById_Bench, [] {
   ServoSetPropertyByIdBench(NS_LITERAL_CSTRING("10px"));
 });
 
 MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_SetPropertyById_WithInitialSpace_Bench, [] {
   ServoSetPropertyByIdBench(NS_LITERAL_CSTRING(" 10px"));
 });