Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7561603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:11:56+00:00 2026-05-30T13:11:56+00:00

My job is mainly in high-performance ‘scientific’ computing. I’ve been doing that for ~15

  • 0

My job is mainly in high-performance ‘scientific’ computing. I’ve been doing that for ~15 years now, but only recently realized that my software wastes computational time. In short words: my ways of writing efficient C++ code no longer work.

From time to time I see a piece of code, written by some kid, that does basically the same calculations as mine (same algorithm, similar approach), but – magically! – performs far faster. In most cases I’m even unable of tracking down the origins of the difference!

My question is: how can I learn the art of modern C++ code optimization? Perhaps something on SSE, caching/mem alignment issues? Any suggestion of book, PDF, article, exercise or website is welcome!

PS. I’m well aware of tricks that are either:

  • Too general (e.g. ‘Use profiler’, ‘Use good algorithms’, ‘Go multithreaded’)
  • Trivial (e.g. ‘Avoid virtual functions’, ‘Do ++i instead of i++’, ‘Enable -O3’)
  • Questionable (e.g. ‘Reuse memory with reinterpret_cast<>’, ‘Tabularize sine and cosine’, ‘Write inline assembly’)
  • Ridiculous (e.g. ‘Do template metaprogramming’)

These are not what I’m asking about.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:11:57+00:00Added an answer on May 30, 2026 at 1:11 pm

    I too work in scientific computation though for rather longer than OP and mainly in Fortran. here’s a little advice from my experience;

    1) Keep up to date with what compiler(s) can do. On the one hand don’t try to beat the compiler at optimisation tricks that the compiler knows about, on the other, know what compilers still aren’t good at. For example, right now I think I can do a better job than my compiler at loop tiling. Learn too how to make it easy for the compiler to optimise code.

    OP will be tempted to pass this point off as an example of advice which is too general to be of use. I see that the Intel C++ compiler manual has about 800 pages of documentation of the compiler options, and a further 400 on optimizing applications. Has OP read all this (or similar quantity of documentation for preferred compiler) ?

    2) Keep up to date with computer architecture, in particular with the design of the memory hierarchy and of the fpus. If nothing else, this helps to understand what the limits of performance one can reasonable expect might be. But it also provides input to decisions on program design and implementation, and indications of how those decisions ought to change when programs are moved to the next generation of hardware.

    3) Use libraries. Write code as a last resort.

    4) Don’t pooh-pooh ideas such as template metaprogramming which have a very good reputation for helping the programmer to create fast code. Study Boost and Blitz.

    5) Program performance is an empirical discipline. Believe only data, not argument. Not even argument made by me.

    Finally, even in large-scale high-performance computing (my largest jobs run for days on 10K CPUs and more so I have a little knowledge of this), sometimes the activity to optimise is development time, not execution time.

    PS Did you ask the kid for instruction ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using netbeans for a couple of years now, mainly on PHP /
I have a cron job on an Ubuntu Hardy VPS that only half works
I'm trying to develop a web application that mainly uses PHP but i'm using
I know that Job.all returns an array of all jobs. But, what would be
A job came in to me that's built with CodeCharge - had a look
In my current job the supervisor's practice is to only check in production ready
In a previous job we had a classic ASP application that no one wanted
I started a new job in a company that loves using the word, enterprise.
At my job we develop websites - however now we're going to make a
I've been through the Android tutorials - these do a good job of introducing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.