<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Chain tool speed</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4662/chain-tool-speed</link><description>Hello I&amp;#39;v just ordered a NRF51-DK kit. 
 I&amp;#39;m looking at the different tool chain. In my application speed is critical 16Mhz is actually bearly enough, so my question is: 
 -Is there a difference in the execution speed of the same code written : Keil</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Dec 2014 14:38:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4662/chain-tool-speed" /><item><title>RE: Chain tool speed</title><link>https://devzone.nordicsemi.com/thread/16552?ContentTypeID=1</link><pubDate>Thu, 04 Dec 2014 14:38:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40b0b515-347b-4c8d-8698-5edd04ba77e1</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;This is also an interesting read regarding optimization. The modulo operator is something embedded engineers fear like the plague, but it&amp;#39;s actually efficient on the ARM platform:
&lt;a href="http://embeddedgurus.com/stack-overflow/2011/02/efficient-c-tip-13-use-the-modulus-operator-with-caution/"&gt;embeddedgurus.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When it comes to speed, it&amp;#39;s as Nguyen says, it&amp;#39;s the code that the developer writes that has the most impact.&lt;/p&gt;
&lt;p&gt;Doing shift-operations are always efficient compared to doing division/multiplication.
I&amp;#39;ve seen many funky macro functions for effective divisions, which are purely made with regards to speed, and to be accurate enough for the scope it&amp;#39;s used in.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s a fantastic snippet from Quake 3 src sqrt calculation:
&lt;a href="http://en.wikipedia.org/wiki/Fast_inverse_square_root"&gt;en.wikipedia.org/.../Fast_inverse_square_root&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Cheers,
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Chain tool speed</title><link>https://devzone.nordicsemi.com/thread/16551?ContentTypeID=1</link><pubDate>Thu, 04 Dec 2014 13:13:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9d783c4-e951-464b-ba75-bff9fbb92452</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;It&amp;#39;s all about how you write your code.  Knowing how the compiler generate code and write optimize code would be the latest.  One compiler with same setting you can have 2 sets of code with one running faster the the other.&lt;/p&gt;
&lt;p&gt;A simple example&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;a = b / 2;  // Takes many cpu cycles
a = b &amp;gt;&amp;gt; 1; // only 1 cycle
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Compiler will not optimize that for you.&lt;/p&gt;
&lt;p&gt;There is a good book on writing optimized code.&lt;/p&gt;
&lt;p&gt;&amp;quot;C++ Footprint and Performance Optimization&amp;quot;  by Rene Alexander &amp;amp; Grahm Bensley.  Published by SAMS.
ISBN 0-672-31904-7&lt;/p&gt;
&lt;p&gt;PS. mBed not recommended for speed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Chain tool speed</title><link>https://devzone.nordicsemi.com/thread/16550?ContentTypeID=1</link><pubDate>Thu, 04 Dec 2014 11:28:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd9b1128-b6ee-4ca1-bd83-2d60ca2a03eb</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;I don&amp;#39;t think it is a definitive answer for that, except that i believe Mbed would be slower because it is higher level.  Both in Keil and GCC you have optimization options:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html"&gt;gcc.gnu.org/.../Optimize-Options.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.keil.com/support/man/docs/uv4/uv4_dg_adscc.htm"&gt;www.keil.com/.../uv4_dg_adscc.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In Keil you have the -Otime optimization, which will optimize for execution time. But, in the end I believe you just have to test, because it depends on your code.&lt;/p&gt;
&lt;p&gt;You can use a 32MHz crystal, but the chip only runs on 16MHz anyway. It just divides the clock.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>