Closed Bug 1577263 Opened 5 years ago Closed 5 years ago

Use memcmp for nsID::Equals

Categories

(Core :: XPCOM, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: kmag, Assigned: kmag)

Details

Attachments

(1 file)

It's been a few years since we last tried this, and compilers have come a long way. Clang compiles memcmp(*this, &aOther, sizeof *this) to a single SIMD operation, and since we now use Clang everywhere, we shouldn't see any variability across platforms.

Compilers have gotten a lot better since the last time we tried this, and the
generated SIMD code for the inlined memcmp is more efficient than our manual
comparison operations.

Pushed by maglione.k@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/3e2987e01215
Use memcmp for nsID::Equals. r=froydnj

FYI, comparing member-by-member gave the exact same code as the SIMD'd memcmp on x86-64 clang, and the same code as the old Equals on ARM:
https://godbolt.org/z/QTmG90

That's what you wanted to achieve, right? (But without the #ifdefs, and no C casts.)
I'll let you decide if it's worth changing again. 😉

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: