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 8005181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:09:22+00:00 2026-06-04T17:09:22+00:00

I have been developing C++ code for augmented reality on ARM devices and optimization

  • 0

I have been developing C++ code for augmented reality on ARM devices and optimization of the code is very important in order to
keep a good frame rate. In order to rise efficiency to the maximum level I think it is important to gather general tips that
make life easier for compilers and reduce the number of cicles of the program. Any suggestion is welcomed.

1- Avoid high-cost instructions: division, square root, sin, cos

  • Use logical shifts to divide or multiply by 2.
  • Multiply by the inverse when possible.

2- Optimize inner “for” loops: they are a botleneck so we should avoid making many calculations inside, especially divisions, square roots..

3- Use look-up tables for some mathematical functions (sin, cos, …)

USEFUL TOOLS

  • objdump: gets assembly code of compiled program. This allows to compare two functions and check if it is really optimized.
  • 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-06-04T17:09:23+00:00Added an answer on June 4, 2026 at 5:09 pm

    To answer your question about general rules when optimizing C++ code for ARM, here are a few suggestions:

    1) As you mentioned, there is no divide instruction. Use logical shifts or multiply by the inverse when possible.
    2) Memory is much slower than CPU execution; use logical operations to avoid small lookup tables.
    3) Try to write 32-bits at a time to make best use of the write buffer. Writing shorts or chars will slow the code down considerably. In other words, it’s faster to logical-OR the smaller bits together and write them as DWORDS.
    4) Be aware of your L1/L2 cache size. As a general rule, ARM chips have much smaller caches than Intel.
    5) Use SIMD (NEON) when possible. NEON instructions are quite powerful and for “vectorizable” code, can be quite fast. NEON intrinsics are available in most C++ environments and can be nearly as fast as writing hand tuned ASM code.
    6) Use the cache prefetch hint (PLD) to speed up looping reads. ARM doesn’t have smart precache logic the way that modern Intel chips do.
    7) Don’t trust the compiler to generate good code. Look at the ASM output and rewrite hotspots in ASM. For bit/byte manipulation, the C language can’t specify things as efficiently as they can be accomplished in ASM. ARM has powerful 3-operand instructions, multi-load/store and “free” shifts that can outperform what the compiler is capable of generating.

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

Sidebar

Related Questions

I have been developing an application for iPad that is very graphically intensive. I
I have been developing Android application where I use this code: Date d=new Date(new
I have been developing some Django app and there's some duplicated code for different
In the past, I have been developing in a very amateurish fashion, meaning I
I have been developing some code that uses Data.Array to use multidimensional arrays, now
I have been developing a bit of code for the last few weeks. The
I have been developing Java programs that parse html source code of webpages by
Recently, I have been developing a practice of making many things in my code
I have been developing an application over the last few months using EF code
We have been developing code using loose coupling and dependency injection. A lot of

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.