Commit 39b35dfc authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Commit Bot

Remove ShapeRunCacheSize experiment

This CL is reducing the ShapeRun cache size from 10k to 1k. Experiment
shows that there is no performance cost to reduce the cache size to
1k entries.

This is mostly a revert of :
  https://chromium-review.googlesource.com/c/chromium/src/+/2051976/

Bug: 1050793
Change-Id: Ic4624611186c39f75f2dbc549438b923d587ced0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2323141
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792606}
parent 9b8f4712
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "base/i18n/rtl.h" #include "base/i18n/rtl.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/numerics/safe_conversions.h" #include "base/numerics/safe_conversions.h"
...@@ -66,13 +65,6 @@ namespace gfx { ...@@ -66,13 +65,6 @@ namespace gfx {
namespace { namespace {
// Experiment to determine best cache size (see https://crbug.com/1050793).
const base::Feature kShapeRunCacheSize = {"ShapeRunCacheSize",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::FeatureParam<int> kShapeRunCacheSizeParam = {&kShapeRunCacheSize,
"CacheSize", 10000};
// Text length limit. Longer strings are slow and not fully tested. // Text length limit. Longer strings are slow and not fully tested.
const size_t kMaxTextLength = 10000; const size_t kMaxTextLength = 10000;
...@@ -1262,14 +1254,16 @@ struct ShapeRunWithFontInput { ...@@ -1262,14 +1254,16 @@ struct ShapeRunWithFontInput {
size_t hash = 0; size_t hash = 0;
}; };
// An MRU cache of the results from calling ShapeRunWithFont. Use the same // An MRU cache of the results from calling ShapeRunWithFont. The maximum cache
// maximum cache size as is used in blink::ShapeCache. // size used in blink::ShapeCache is 10k. A Finch experiment showed that
// reducing the cache size to 1k has no performance impact.
constexpr int kShapeRunCacheSize = 1000;
using ShapeRunCacheBase = base::HashingMRUCache<ShapeRunWithFontInput, using ShapeRunCacheBase = base::HashingMRUCache<ShapeRunWithFontInput,
TextRunHarfBuzz::ShapeOutput, TextRunHarfBuzz::ShapeOutput,
ShapeRunWithFontInput::Hash>; ShapeRunWithFontInput::Hash>;
class ShapeRunCache : public ShapeRunCacheBase { class ShapeRunCache : public ShapeRunCacheBase {
public: public:
ShapeRunCache() : ShapeRunCacheBase(kShapeRunCacheSizeParam.Get()) {} ShapeRunCache() : ShapeRunCacheBase(kShapeRunCacheSize) {}
}; };
void ShapeRunWithFont(const ShapeRunWithFontInput& in, void ShapeRunWithFont(const ShapeRunWithFontInput& in,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment