From b9198f3b3a9fc22118e1d40888d8423eac448ad1 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Fri, 26 Apr 2024 01:11:34 +0100 Subject: Adjust JIT thresholds. Reduce the default case to avoid JITting too much, and increase the lookup threshold for the UI thread. Reduces jank on compose view scrolling for 4 iterations: - For Go Mokey: - Before: ~1048 frames drawn / ~4.05% janky frames - After: ~1107 frames drawn / ~3.55% janky frames - For Pixel 8 pro: - Before: ~2575 frames drawn / ~0.60% janky frames - After: ~2582 frames drawn / ~0.58% janky frames Bug: 313040662 Change-Id: Ib0a977b933912da53be96a8c53d74a8df0fb0756 --- runtime/interpreter/mterp/nterp.cc | 5 +++-- runtime/jit/jit_options.cc | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/runtime/interpreter/mterp/nterp.cc b/runtime/interpreter/mterp/nterp.cc index bcc59a4032..d8ce2bcaed 100644 --- a/runtime/interpreter/mterp/nterp.cc +++ b/runtime/interpreter/mterp/nterp.cc @@ -118,8 +118,9 @@ void CheckNterpAsmConstants() { inline void UpdateHotness(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) { // The hotness we will add to a method when we perform a // field/method/class/string lookup. - constexpr uint16_t kNterpHotnessLookup = 0xff; - method->UpdateCounter(kNterpHotnessLookup); + bool increase_hotness_for_ui = Runtime::Current()->InJankPerceptibleProcessState() && + Thread::Current()->IsJitSensitiveThread(); + method->UpdateCounter(increase_hotness_for_ui ? 0x6ff : 0xf); } template diff --git a/runtime/jit/jit_options.cc b/runtime/jit/jit_options.cc index 3c31d1dfcd..b68d14e427 100644 --- a/runtime/jit/jit_options.cc +++ b/runtime/jit/jit_options.cc @@ -31,7 +31,7 @@ static constexpr uint32_t kJitStressDefaultOptimizeThreshold = kJitDefaultOptimi static constexpr uint32_t kJitSlowStressDefaultOptimizeThreshold = kJitStressDefaultOptimizeThreshold / 2; -static constexpr uint32_t kJitDefaultWarmupThreshold = 0x3fff; +static constexpr uint32_t kJitDefaultWarmupThreshold = 0xffff; // Different warm-up threshold constants. These default to the equivalent warmup thresholds divided // by 2, but can be overridden at the command-line. static constexpr uint32_t kJitStressDefaultWarmupThreshold = kJitDefaultWarmupThreshold / 2; -- cgit v1.2.3