diff options
author | win7-7 <win7-7@users.noreply.github.com> | 2019-05-25 18:02:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-25 18:02:40 +0300 |
commit | 733f6b770fcd7c2e5577bfb1fc738dc6ae5c3920 (patch) | |
tree | b50e469d3e4d8e0074138e197cdaa6456d72b10c /xpcom/ds/nsIAtom.idl | |
parent | 915ffc660053cc48153c00dec66b913517dba794 (diff) | |
download | UXP-733f6b770fcd7c2e5577bfb1fc738dc6ae5c3920.tar UXP-733f6b770fcd7c2e5577bfb1fc738dc6ae5c3920.tar.gz UXP-733f6b770fcd7c2e5577bfb1fc738dc6ae5c3920.tar.lz UXP-733f6b770fcd7c2e5577bfb1fc738dc6ae5c3920.tar.xz UXP-733f6b770fcd7c2e5577bfb1fc738dc6ae5c3920.zip |
use memcmp for nsIAtom Equals to improve performance xpcom/ds
issue #1113 Use memcmp and not slower string Equals in nsHtml5Portability::localEqualsBuffer
Diffstat (limited to 'xpcom/ds/nsIAtom.idl')
-rw-r--r-- | xpcom/ds/nsIAtom.idl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/xpcom/ds/nsIAtom.idl b/xpcom/ds/nsIAtom.idl index 6e8602c42..ce4cff485 100644 --- a/xpcom/ds/nsIAtom.idl +++ b/xpcom/ds/nsIAtom.idl @@ -37,9 +37,15 @@ interface nsIAtom : nsISupports size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf); %{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 { - return aString.Equals(nsDependentString(mString, mLength)); + return Equals(aString.BeginReading(), aString.Length()); } inline bool IsStaticAtom() const { |