Question

When coding performance-critical portions of code (not necessarily large, but code that gets executed a lot),...

When coding performance-critical portions of code (not necessarily large, but code that gets executed a lot), what topics should I be aware of/take into account.

I'm already fairly familiar with caching, aliasing, branching, cost of arithmetic operations, loop unrolling (and I guess some others that don't come to mind).

What else should I know? (not necessarily looking for details, just concepts I can look up on my own)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I think when it comes to performance, being familiar with the compiler optimization strategies and methods is essential. What this helps you with is that when you understand what kind of optimizations the compiler is capable of doing and under which circumstances, you actually can offload the performance tuning to the compiler(as you should anyway, if possible) by making sure that you give it the maximum possible opportunity to optimize the code.

Of course being familiar with tools which assist you with profiling and benchmarking your code/implementations is an essential. Infact, there's no point in optimizing unless you can measure the benefit. In the end this boils down to being able to reason between multiple implementations and what and why the performance differs at the lowest level possible - without this understanding it is very hard to come up with valid optimizing opportunities which you can reason about.

As the bottom line I would argue that being familiar with the compiler and it's optimizing capabilities and opportunities as well as being familiar with tools to measure benefits and spot bottlenecks as well as understanding the CPU's capabilities and instruction set are the three most important things for any programmer when it comes to writing performant native code. Yes, this is very general but as such it's also very applicable. Everything boils down to this in the end.

Add a comment
Know the answer?
Add Answer to:
When coding performance-critical portions of code (not necessarily large, but code that gets executed a lot),...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Read this article. Then write a 250 word response on two of the programs you like...

    Read this article. Then write a 250 word response on two of the programs you like the most. Open source business intelligence software 1. BIRT BIRT is an open source BI program that CloudTweaks says is often viewed as the industry standard. BIRT boasts “over 12 million downloads and over 2.5 million developers across 157 countries.” Its users include heavyweights such as Cisco, S1, and IBM (which is also a BIRT sponsor). They also have maturity going for them, as...

  • For the preparation and standardization of NaOH with KHP im supposed to boil water for 1hr and 30 min to remove CO2

    For the preparation and standardization of NaOH with KHP im supposed to boil water for 1hr and 30 min to remove CO2....the problem is that if I don't boil it for that long and (30 min) b/c of not enough time but I put the water I boiled for 1/2 hr aproximately into a NaOH bottle with a CO2 absorber and stored it there for a few days. I would assume that I would have to boil the water again...but...

  • please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun...

    please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun 28, 2019 at 11:59 PM Please read the article titled Evolution of Operations Planning and Control: from production to supply chains In at least three paragraphs, describe how and why the focus of operations planning and control has changed over time. While one might argue that answers consisting of sentences quoted from articles do not represent plagiarism, I do not consider them acceptable, and...

  • please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun...

    please read instructions on the first picture and follow it Discussion Board: Chapter 1 Due: Jun 28, 2019 at 11:59 PM Please read the article titled Evolution of Operations Planning and Control: from production to supply chains In at least three paragraphs, describe how and why the focus of operations planning and control has changed over time. While one might argue that answers consisting of sentences quoted from articles do not represent plagiarism, I do not consider them acceptable, and...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT