mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
518297a7d8
Some profiling of tcampbell's React benchmark [1] shows 6.1 million calls to js::frontend::GeneralTokenStreamChars<..>::getFullAsciiCodePoint, using 110.57 million instructions (x86_64). That comes out to only 18 insns per call, which suggests the method is a good candidate for inlining, but it isn't inlined. Merely parking an inline annotation on it doesn't help much, because it gets inlined into js::frontend::TokenStreamSpecific<..>::getCodePoint, but that isn't inlined into *its* caller(s), so the 6.1 million calls move to ::getCodePoint instead. This patch requests inlining for both ::getFullAsciiCodePoint and ::getCodePoint and adds some MOZ_NEVER_INLINE annotations to ensure that cold paths *don't* get inlined into these two, to reduce code bloat and avoid excessive register pressure. IsAscii functions in mfbt/TextUtils.h have been marked inline as a precaution; this probably isn't necessary. Run time with config [2] is reduced from 0.390 seconds to 0.379 seconds (2.8% speedup, best of 50 runs), and from 0.402 to 0.396 seconds (median of 50 runs). Instruction count falls from 3511.8 million to 3395.8 million, and the number of data accesses from 1563.7 million to 1487.4 million -- a 4.8% reduction that is probably caused by avoidance of save/restore sequences in the inlined fns. [1] https://github.com/mozilla-spidermonkey/matrix-react-bench [2] Fedora 35, x86_64, Intel Core i5 1135G7 at 4 ish GHz configure: --disable-debug --enable-optimize="-g -O2" run: --no-threads Differential Revision: https://phabricator.services.mozilla.com/D159500 |
||
---|---|---|
.. | ||
double-conversion | ||
lz4 | ||
tests | ||
Algorithm.h | ||
Alignment.h | ||
AllocPolicy.h | ||
AlreadyAddRefed.h | ||
Array.h | ||
ArrayUtils.h | ||
Assertions.cpp | ||
Assertions.h | ||
AtomicBitfields.h | ||
Atomics.h | ||
Attributes.h | ||
BinarySearch.h | ||
BitSet.h | ||
BloomFilter.h | ||
Buffer.h | ||
BufferList.h | ||
Casting.h | ||
ChaosMode.cpp | ||
ChaosMode.h | ||
Char16.h | ||
CheckedInt.h | ||
CompactPair.h | ||
Compiler.h | ||
Compression.cpp | ||
Compression.h | ||
DbgMacro.h | ||
DebugOnly.h | ||
DefineEnum.h | ||
DoublyLinkedList.h | ||
EndianUtils.h | ||
EnumeratedArray.h | ||
EnumeratedRange.h | ||
EnumSet.h | ||
EnumTypeTraits.h | ||
fallible.h | ||
FastBernoulliTrial.h | ||
FloatingPoint.cpp | ||
FloatingPoint.h | ||
FStream.h | ||
FunctionRef.h | ||
FunctionTypeTraits.h | ||
Fuzzing.h | ||
HashFunctions.cpp | ||
HashFunctions.h | ||
HashTable.h | ||
HelperMacros.h | ||
InitializedOnce.h | ||
IntegerRange.h | ||
IntegerTypeTraits.h | ||
JSONWriter.cpp | ||
JSONWriter.h | ||
JsRust.h | ||
Latin1.h | ||
Likely.h | ||
LinkedList.h | ||
MacroArgs.h | ||
MacroForEach.h | ||
MathAlgorithms.h | ||
Maybe.h | ||
MaybeOneOf.h | ||
MaybeStorageBase.h | ||
MemoryChecking.h | ||
MemoryReporting.h | ||
MoveOnlyFunction.h | ||
moz.build | ||
NonDereferenceable.h | ||
NotNull.h | ||
Opaque.h | ||
OperatorNewExtensions.h | ||
PairHash.h | ||
Path.h | ||
PodOperations.h | ||
Poison.cpp | ||
Poison.h | ||
RandomNum.cpp | ||
RandomNum.h | ||
Range.h | ||
RangedArray.h | ||
RangedPtr.h | ||
ReentrancyGuard.h | ||
RefCounted.h | ||
RefCountType.h | ||
RefPtr.h | ||
Result.h | ||
ResultExtensions.h | ||
ResultVariant.h | ||
ReverseIterator.h | ||
RollingMean.h | ||
Saturate.h | ||
Scoped.h | ||
ScopeExit.h | ||
SegmentedVector.h | ||
SHA1.cpp | ||
SHA1.h | ||
SharedLibrary.h | ||
SmallPointerArray.h | ||
Span.h | ||
SplayTree.h | ||
SPSCQueue.h | ||
StaticAnalysisFunctions.h | ||
STYLE | ||
TaggedAnonymousMemory.cpp | ||
TaggedAnonymousMemory.h | ||
Tainting.h | ||
TemplateLib.h | ||
TextUtils.h | ||
ThreadLocal.h | ||
ThreadSafety.h | ||
ThreadSafeWeakPtr.h | ||
ToString.h | ||
TsanOptions.h | ||
Tuple.h | ||
TypedEnumBits.h | ||
Types.h | ||
TypeTraits.h | ||
UniquePtr.h | ||
UniquePtrExtensions.cpp | ||
UniquePtrExtensions.h | ||
Unused.cpp | ||
Unused.h | ||
Utf8.cpp | ||
Utf8.h | ||
Variant.h | ||
Vector.h | ||
WasiAtomic.h | ||
WeakPtr.h | ||
WindowsVersion.h | ||
WrappingOperations.h | ||
XorShift128PlusRNG.h |