Bug #2824
closedNew higher speed CRC code
0%
Description
Dear DragonFlyBSD bugs,
This isn't really a bug. I noticed there is the possibility of improving
the performance of the recently committed new CRC code ("fast iscsi crc
code").
In the following function:
sys/libkern/icrc32.c
<http://gitweb.dragonflybsd.org/dragonfly.git/blob/d557434b1f5510b6fed895379af444f0d034c07b:/sys/libkern/icrc32.c>
static uint32_t
singletable_crc32c(uint32_t crc, const void *buf, size_t size)
{
const uint8_t *p = buf;
while (size--)
crc = crc32Table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
return crc;
}
The two separate operations of "size--" and "*p++" could be combined into
one operation. The way that I would do that would be something like:
...
size_t I;
for (i = 0; i < size; ++i) {
crc = crc32Table[(crc ^ p[i]) & 0xff] ^ (crc >> 8);
}
...
So you would be saving one operation; performance improvement.
I haven't looked at the rest of the code, so perhaps there are other
performance improvements that could be had.
Hope this helps ...
--
Sincerely,
Robin Carey BSc