Bug 19412 – std.algorithm.cmp with default ordering can use memcmp for all size 1 unsigned types (instead of just char)

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-11-19T16:33:02Z
Last change time
2019-04-12T17:30:09Z
Keywords
pull
Assigned to
No Owner
Creator
Nathan S.

Comments

Comment #0 by n8sh.secondary — 2018-11-19T16:33:02Z
Currently memcmp is just used for char[], but it can logically be used for any unsigned type that either has a size of 1 byte or is big-endian. This applies only when the default ordering is used.
Comment #1 by n8sh.secondary — 2018-11-19T20:00:55Z
Comment #2 by dlang-bot — 2019-03-09T00:38:42Z
@n8sh updated dlang/phobos pull request #6776 "std.algorithm.cmp with default ordering can use memcmp for all big-endian or size 1 unsigned types (instead of just char)" fixing this issue: - Fix Issue 19412 - std.algorithm.cmp with default ordering can use memcmp for all big-endian or size 1 unsigned types ... instead of just char. https://github.com/dlang/phobos/pull/6776
Comment #3 by n8sh.secondary — 2019-03-09T00:40:23Z
Benchmarking shows that whether memcmp is an improvement or not for wider-than-byte types depends on input length, so this is conservatively being changed to just unsigned byte-width types.
Comment #4 by dlang-bot — 2019-04-12T17:30:09Z
dlang/phobos pull request #6776 "std.algorithm.cmp with default ordering can use memcmp for all size 1 unsigned types (instead of just char)" was merged into master: - 7bfb20737647948d16dcf3a7e16796da89f229cb by Nathan Sashihara: Fix Issue 19412 - std.algorithm.cmp with default ordering can use memcmp for all size 1 unsigned types ... instead of just char. https://github.com/dlang/phobos/pull/6776