Bug #91485 ut_crc32_hw() checks ut_crc32_cpu_enabled on each call

Submitted: 29 Jun 2018 6:32 Modified: 20 Jul 2018 17:10
Reporter: Alexey Kopytov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:5.7.22, 8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[29 Jun 2018 6:32] Alexey Kopytov
Description:
ut_crc32_hw() and a few other functions have this code at the very
beginning:

MY_ATTRIBUTE((target("sse4.2")))
static uint32_t ut_crc32_hw(const byte *buf, ulint len) {
  uint64_t crc = 0xFFFFFFFFU;

  ut_a(ut_crc32_cpu_enabled);
  ...
}

It doesn't make much sense to check if HW support is available every
time we want to compute a HW-optimized checksum.

It probably has a negligible performance impact in real-life scenarios,
but small things like that contribute to the notorious code bloat
affecting single-threaded performance. And to global warming!

This is a request to convert it to a debug assertion.

How to repeat:
Look for occurrences of ut_crc32_cpu_enabled in crc32.cc.

Suggested fix:
Make it a debug assertion.
[29 Jun 2018 6:58] Alexey Kopytov
Adding 5.7.
[29 Jun 2018 8:40] MySQL Verification Team
Hello Alexey,

Thank you for your report and feature request to convert it to a debug assertion!

Regards,
Umesh
[20 Jul 2018 17:10] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 8.0.13 release, and here's the changelog entry:

To avoid checking hardware support each time a hardware-optimized
checksum is computed, asserts were converted to debug-only asserts.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.