Skip to content

Commit 7e32508

Browse files
committed
[JSC] Raise the FTL tier-up thresholds on Linux ARM64 devices with four or fewer cores
https://bugs.webkit.org/show_bug.cgi?id=329738 Reviewed by Carlos Garcia Campos. On small ARM64 Linux devices, FTL compiles many functions that do not live long enough to pay back the compile. Speedometer is the clearest case: it creates its workloads again in every iteration, so each new instance of a function tiers up again from scratch. 317242@main raised the tier-up thresholds for Macs with few performance cores for related reasons; do the same for the FTL thresholds on Linux ARM64 devices with four or fewer cores, by a factor of 4 Android is left out: it was not measured, and numberOfProcessorCores() counts the online cores (_SC_NPROCESSORS_ONLN), which changes on phones that take cores offline. Measured on a Raspberry Pi 4 with the WPE perf bot 325247@main, we get a +5.2% improvement in Speedometer 3.1 and a 2.8% improvement in JetStream 2. * Source/JavaScriptCore/runtime/Options.cpp: (JSC::overrideDefaults): * Source/JavaScriptCore/runtime/OptionsList.h: Canonical link: https://commits.webkit.org/325731@main
1 parent 1a10955 commit 7e32508

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎Source/JavaScriptCore/runtime/Options.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,14 @@ static void overrideDefaults()
644644
}
645645
#endif
646646

647+
#if OS(LINUX) && !OS(ANDROID) && CPU(ARM64)
648+
constexpr int maxCoresForThresholdScaling = 4;
649+
if (WTF::numberOfProcessorCores() <= maxCoresForThresholdScaling) {
650+
Options::thresholdForFTLOptimizeAfterWarmUp() *= Options::ftlThresholdScaleForFewCores();
651+
Options::thresholdForFTLOptimizeSoon() *= Options::ftlThresholdScaleForFewCores();
652+
}
653+
#endif
654+
647655
#if USE(MEMORY_FOOTPRINT_API)
648656
// On iOS and conditionally Linux, we control heap growth using process memory footprint. Therefore these values can be agressive.
649657
Options::smallHeapRAMFraction() = 0.8;

‎Source/JavaScriptCore/runtime/OptionsList.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ bool hasCapacityToUseLargeGigacage();
365365
v(Int32, numberOfSuperAndPerformanceCoresOverride, 0, Normal, "If non-zero, overrides the number of Super and Performance (i.e. non-Efficiency) cores reported by the hardware; 0 means use the value reported by the hardware."_s) \
366366
v(Double, dfgThresholdScaleForFewPerformanceCores, 2.0, Normal, "On Apple silicon Macs with few Super and Performance cores, scale the DFG tier-up thresholds (thresholdForOptimize*) by this factor."_s) \
367367
v(Double, ftlThresholdScaleForFewPerformanceCores, 1.5, Normal, "On Apple silicon Macs with few Super and Performance cores, scale the FTL tier-up thresholds (thresholdForFTLOptimize*) by this factor."_s) \
368+
v(Double, ftlThresholdScaleForFewCores, 4.0, Normal, "On Linux ARM64 devices (not Android) with four or fewer cores, scale the FTL tier-up thresholds (thresholdForFTLOptimize*) by this factor."_s) \
368369
v(Bool, forceEagerCompilation, false, Normal, nullptr) \
369370
v(Int32, thresholdForJITAfterWarmUp, 500, Normal, nullptr) \
370371
v(Int32, thresholdForJITSoon, 100, Normal, nullptr) \

0 commit comments

Comments
 (0)