Open Bug 1807213 Opened 3 years ago Updated 3 years ago

nsTStringRepr<T>::Equals should probably compare bytes also from the end of the data

Categories

(Core :: String, enhancement)

enhancement

Tracking

()

People

(Reporter: smaug, Unassigned)

Details

The nsCharTraits stuff returns not just equality, but break unequality to lexicographically less-than or greater-than. However, the callers only care about equal or unequal. So that's not a reason to compare forward.

These days caches should work with consistently backward-progressing reads.

memcmp also uselessly returns less-than/greater-than and compares forward.

I wonder if it's worthwhile to try to manually unroll by 8 for char16_t or by 16 for unsigned char to get basic autovectorization.

We should probably loop backwards and unroll in a way that autovectorizes. x86_64: https://godbolt.org/z/1T54Wdc9b ; not quite as nice on aarch64: https://godbolt.org/z/sT158hn9W

You need to log in before you can comment on or make changes to this bug.