<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Code Optimization (for speed)? in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Code-Optimization-for-speed/m-p/214445#M6128</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;My main tip would be to turn on optimisation and look at the output of the compiler to see what code it generates. There is a lot of "folklore" around optimisation which either was true once but isn't now or never was true anyway. There are a lot of special cases which depend on the specific target and compiler implementation. It's best not to rely on second hand info or make assumptions about what the compiler will do.&lt;BR /&gt;&lt;BR /&gt;I have never heard signed variables are faster, what makes you think that?&lt;BR /&gt;&lt;BR /&gt;To look at the assembler output use the Debugger "mixed" view, or turn on the option to generate assembler.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by bobc on &lt;SPAN class="date_text"&gt;2009-02-17&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;12:20 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Feb 2009 20:19:44 GMT</pubDate>
    <dc:creator>bobc</dc:creator>
    <dc:date>2009-02-17T20:19:44Z</dc:date>
    <item>
      <title>Code Optimization (for speed)?</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Code-Optimization-for-speed/m-p/214444#M6127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using CW7.3 on the DSP56F805EVM board and I need my code to run as quickly as possible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Will the code run faster if all variables are declared as signed rather than unsigned - or does the built is optimization correct these for the quickest possible operation?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Which will result in fewer instructions, a for( ; ; ) or a while(1)? In an un-optimized environment, the while(1) would result in a fetch from ROM, a compare &amp;amp; goto - whereas a for( ; ; ) would result in just a goto. Does the compiler optimize the while(1) correctly to just a goto?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(yes - I am stretching for clock cycles)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Can anyone provide me with more tips/tricks/techniques to code for speedy execution?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Code size is not a worry - it's the execution time I need to get down, whilst still coding in C.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any assistance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Greg&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2009 16:37:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Code-Optimization-for-speed/m-p/214444#M6127</guid>
      <dc:creator>GregM</dc:creator>
      <dc:date>2009-01-08T16:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Code Optimization (for speed)?</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Code-Optimization-for-speed/m-p/214445#M6128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;My main tip would be to turn on optimisation and look at the output of the compiler to see what code it generates. There is a lot of "folklore" around optimisation which either was true once but isn't now or never was true anyway. There are a lot of special cases which depend on the specific target and compiler implementation. It's best not to rely on second hand info or make assumptions about what the compiler will do.&lt;BR /&gt;&lt;BR /&gt;I have never heard signed variables are faster, what makes you think that?&lt;BR /&gt;&lt;BR /&gt;To look at the assembler output use the Debugger "mixed" view, or turn on the option to generate assembler.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by bobc on &lt;SPAN class="date_text"&gt;2009-02-17&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;12:20 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2009 20:19:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Code-Optimization-for-speed/m-p/214445#M6128</guid>
      <dc:creator>bobc</dc:creator>
      <dc:date>2009-02-17T20:19:44Z</dc:date>
    </item>
  </channel>
</rss>

