[DragonFlyBSD - Bug #2824] (New) New higher speed CRC code

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Tue Jun 9 05:51:22 PDT 2015


Issue #2824 has been reported by robin.carey1.

----------------------------------------
Bug #2824: New higher speed CRC code
http://bugs.dragonflybsd.org/issues/2824

* Author: robin.carey1
* Status: New
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
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



-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list