| 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: | |
| 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: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.

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.