Channels ▼

Stephen Blair-chappell

Dr. Dobb's Bloggers

Speeding Up Code Without Doing Anything

November 15, 2009

Of all the techniques I use to speed up code, the one I like the most comes with just the press of a button, or more precisely at the swap of a compiler Every Intel compiler has this particular option, and I consider to be a great friend. I'm making a point of keeping you in suspense for a little while longer. Let me first tell you a couple of stories that prove the point.

I was involved some time back in supporting a company that was upgrading from version 9.0 to 10.1 of the Intel compiler (we are now on version 11.1). Actually there was no work involved, but I was 'on call' just in case they had any problems. Within a day of upgrading, the project manager wrote to me saying "we must have version 10.1 of the compiler. Our application speed has just doubled in performance." The application was to be their main 'bread winner' for the following two years.

I had a pretty good idea what had happened. In version 9.1 of the compiler, my favourite option had to be turned on explicitly by the developer. Like many users, they didn't get around to reading the user manual or experimenting with some of the compiler switches. In version 10.1 of the compiler Intel changed the default behaviour of the compiler, so my favourite option was already enabled -- hence the speed up in the customers code.

I experienced an even more significant speedup with another customer, resulting in their application running 10 times faster. The application was a car engine simulator which was used in the testing of electronic car management systems.

The engine simulator was first designed in MatLab, and then the resulting C code compiled with the Microsoft compiler. I installed the Intel C++ Compiler which is a plug and play replacement for the Microsoft C++ Compiler, and the simulation sped-up by a factor of 10.

I suppose I have to spill the beans. The option is auto-vectorisation. All recent versions of the Intel compiler have this option available. If you are already using the latest Intel compilers, such as the one that comes with Intel Parallel Studio then the auto-vectoriser is already turned on (unless you have explicitly turned it off).

In the case of the engine simulator, by upgrading the ecosystem to the latest multicore we achieved:

  • An initial speedup of 20% by using the Intel® C++ Compiler on the original hardware
  • A final speedup of over 76 (i.e. 7600%), which consisted of
    • 10 times speedup due to enabling auto-vectorization
    • 7 times speed up due to hardware upgrade

A fuller description of the Engine Simulation project can be found here

A free evaluation of Intel Parallel Studio can be downloaded from here.

Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.
 


Video