mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 04:17:31 +09:00
use memcmp for nsIAtom Equals to improve performance xpcom/ds
issue #1113 Use memcmp and not slower string Equals in nsHtml5Portability::localEqualsBuffer
This commit is contained in:
parent
450910d668
commit
03bf12d98e
2 changed files with 9 additions and 9 deletions
|
|
@ -325,13 +325,7 @@ AtomTableMatchKey(const PLDHashEntryHdr* aEntry, const void* aKey)
|
||||||
nsDependentAtomString(he->mAtom)) == 0;
|
nsDependentAtomString(he->mAtom)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t length = he->mAtom->GetLength();
|
return he->mAtom->Equals(k->mUTF16String, k->mLength);
|
||||||
if (length != k->mLength) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return memcmp(he->mAtom->GetUTF16String(),
|
|
||||||
k->mUTF16String, length * sizeof(char16_t)) == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,15 @@ interface nsIAtom : nsISupports
|
||||||
size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
|
size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
// note this is NOT virtual so this won't muck with the vtable!
|
// note these are NOT virtual so they won't muck with the vtable!
|
||||||
|
inline bool Equals(char16ptr_t aString, uint32_t aLength) const
|
||||||
|
{
|
||||||
|
return mLength == aLength &&
|
||||||
|
memcmp(mString, aString, mLength * sizeof(char16_t)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool Equals(const nsAString& aString) const {
|
inline bool Equals(const nsAString& aString) const {
|
||||||
return aString.Equals(nsDependentString(mString, mLength));
|
return Equals(aString.BeginReading(), aString.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsStaticAtom() const {
|
inline bool IsStaticAtom() const {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue