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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:09:32+00:00 2026-06-06T14:09:32+00:00

Background It is known that random branching costs significant overhead. And there was a

  • 0

Background

It is known that random branching costs significant overhead.
And there was a post in SO answering such question.

Similar performance impact can be seen with jump instructions in many CPU architectures. And there was a post in SO for such theme as well

So if you used programming patterns like function pointer or just normal inheritable C++ class based function call, we have to pay the cost of branch miss.

Even for the most advanced hardware branch prediction algorithms can only do globally shared address history based branch prediction, and perhaps it may speculatively fetch the branch target address code and so on.

But by definition, it won’t work for the first execution.

Many embedded appliance, smartphones, etc should demand maximum performance at

  • boot time
  • first execution of an application like browser

Which calls millions of function calls and may not want to change there software architecture significantly like converting all indirect jumps into direct jumps…

If the conditions are as follows,

Conditions:

  • must run at top speed
    • at the first run
      or
    • the jump looks completely random to the cpu

Is the following best to achieve the result?

And I want to know any example that does dynamic/static code rewrite of indirect to direct jumps.

How to get maximum performance:

  • always use either branch likely or unlikely
  • use prelink
  • use mlock or readahead, cacheflush(ICACHE) the function call
  • rewrite indirect jumps to direct jumps dynamically or statically
    (found a paper written in 1996 by Bradley M Kuhn for static rewrite for some case)

The paper I found was translating virtual function calls to static function call at source code level, but binary link time optimization seemed better for the software developer point of view.

  • 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-06T14:09:34+00:00Added an answer on June 6, 2026 at 2:09 pm

    For function pointers and virtual functions you will need to predict the target of the branch, because you can’t know at compile time which code needs to be executed next.

    http://en.wikipedia.org/wiki/Branch_target_predictor

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

Sidebar

Related Questions

So it is fairly well known that you can add a background image to
Background: I've implemented a stochastic algorithm that requires random ordering for best convergence. Doing
I know that in iOS, background apps can only be running Finite-length tasks (10
I need long-term working background agent in wp7. I know that default and maximum
I have a BlackBerry app running in the background that needs to know when
I have a BlackBerry app running in the background that needs to know when
I would like to know, if I can get the background that is displayed
The exact background color is known. Imagine an anti-aliased font on a green background.
Background I know this question is a little weird, but here's the explanation. I
I need a way for my Activity to known that it's going into the

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.