Boost C++ Libraries: Ticket #3030: [crc] optimization of crc_optimal::process_block https://svn.boost.org/trac10/ticket/3030 <p> Function 'process_block()' can be easily optimized (I got about 20% in performance on ARM9/GCC 3.4.3/4.2.0) </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3030 Trac 1.4.3 qehgt0@… Thu, 14 May 2009 21:19:29 GMT attachment set https://svn.boost.org/trac10/ticket/3030 https://svn.boost.org/trac10/ticket/3030 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">my.patch</span> </li> </ul> <p> patch file for crc.hpp </p> Ticket Olaf van der Spek <olafvdspek@…> Mon, 03 Oct 2011 13:05:25 GMT <link>https://svn.boost.org/trac10/ticket/3030#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3030#comment:1</guid> <description> <p> Daryle? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daryle Walker</dc:creator> <pubDate>Fri, 16 Dec 2011 02:44:11 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3030#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3030#comment:2</guid> <description> <p> The patch replaces using a data member with using a local variable, assigning between the two at the starting and finishing points of the member function. How does this speed things up instead of slowing them down (by using an extra object)? Is member object access that slow, or is there some cache issue?! This seems to be configuration-specific, and I don't want to add something that may help on some systems but hurt on others. </p> </description> <category>Ticket</category> </item> <item> <author>Vasily Titskiy <qehgt0@…></author> <pubDate>Fri, 16 Dec 2011 05:59:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3030#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3030#comment:3</guid> <description> <p> Compiler is assuming (and it is correct assumption from compiler's point of view) that memory location of member variable 'this-&gt;rem' can be between 'bytes_begin' and 'bytes_end'. </p> <p> So, compiler _must_ generate non-optimal code for this loop that always stores temporary value of 'rem' variable into memory before processing every next byte. </p> <p> It should be same or faster on every system. </p> <p> I can check it on msvc2008, armv7-gcc3.2/gcc4.6, intel x86/amd64 later, if it needed. </p> </description> <category>Ticket</category> </item> <item> <author>Vasily Titskiy <qehgt0@…></author> <pubDate>Fri, 16 Dec 2011 06:00:25 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3030#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3030#comment:4</guid> <description> <blockquote class="citation"> <p> It should be same or faster on every system </p> </blockquote> <p> After patch, I mean. </p> </description> <category>Ticket</category> </item> <item> <author>Vasily Titskiy <qehgt0@…></author> <pubDate>Fri, 16 Dec 2011 22:18:00 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3030#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3030#comment:5</guid> <description> <p> I made a (quick-and-dirty) test. Just two source files, to measure time of original and optimized version of crc32 calculation. </p> <p> <a class="ext-link" href="http://pastebin.com/BQDyBmNx"><span class="icon">​</span>http://pastebin.com/BQDyBmNx</a> <a class="ext-link" href="http://pastebin.com/ZUmLB9Cc"><span class="icon">​</span>http://pastebin.com/ZUmLB9Cc</a> </p> <p> And run this test on four platforms: linux-amd64 with gcc 4.6, linux-x86 with gcc 4.6, armv7 with gcc 4.6, win32 with msvc 2008. On Linux "-O3" optimization option was used, on win32 "-O2 -EHsc -MD" options were used. </p> <p> Results: </p> <ul><li>linux-amd64 with gcc 4.6: same time (no difference), </li><li>linux-x86 with gcc 4.6: 105 ms before optimization, 93 ms after (12% better) </li><li>armv7 with gcc 4.6: 360 ms before optimization, 305 ms after (18% better) </li><li>win32 with msvc 2008: 173 ms before optimization, 87 ms after (98% better) </li></ul><p> Pretty good results for just changing few lines of code. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daryle Walker</dc:creator> <pubDate>Tue, 27 Dec 2011 05:03:51 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3030#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3030#comment:6</guid> <description> <p> I did a major re-factoring of the reflection and CRC table code. By moving the actual CRC computation step to a new function, I think I did your suggestion here. The timing tests from <code>crc_test.cpp</code> suggest a doubling in speed (from 39% speed of the reference to 85%)! The changes are at <a class="changeset" href="https://svn.boost.org/trac10/changeset/76197" title="Re-did the compile-time reflection and CRC-table systems, making CRC ...">[76197]</a>. </p> </description> <category>Ticket</category> </item> <item> <author>Vladislav <phprus@…></author> <pubDate>Sun, 26 Feb 2012 12:09:37 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/3030#comment:7 https://svn.boost.org/trac10/ticket/3030#comment:7 <ul> <li><strong>cc</strong> <span class="trac-author">phprus@…</span> added </li> </ul> <p> MS Visual C++ 2010 does not support boolean operator "not" without custom compiler settings. </p> <p> Error: </p> <pre class="wiki">...\boost/crc.hpp(591) : error C2146: syntax error : missing ')' before identifier 'reflect' ...\boost/crc.hpp(592) : error C2059: syntax error : ')' </pre><p> And the same code on line 710. </p> <p> To fix this bug replace "not reflect," to "!reflect," in file boost/crc.hpp </p> Ticket