2 Replies - 1848 Views - Last Post: 16 July 2020 - 03:41 PM Rate Topic: -----

Poll: Are you using branchfree/branchless programming tactic and how often? (2 member(s) have cast votes)

Are you using branchfree/branchless programming tactic and how often?

  1. Always (0 votes [0.00%])

    Percentage of vote: 0.00%

  2. Mostly (0 votes [0.00%])

    Percentage of vote: 0.00%

  3. Sometimes (0 votes [0.00%])

    Percentage of vote: 0.00%

  4. Only When Needed (1 votes [50.00%] - View)

    Percentage of vote: 50.00%

  5. On Purpose (0 votes [0.00%])

    Percentage of vote: 0.00%

  6. Never (1 votes [50.00%] - View)

    Percentage of vote: 50.00%

Vote Guests cannot vote

#1 Radius Nightly   User is offline

  • D.I.C Regular

Reputation: 65
  • View blog
  • Posts: 404
  • Joined: 07-May 15

Are you using branchfree/branchless programming tactic and how often?

Post icon  Posted 14 July 2020 - 02:44 PM

I dont use it, because it does not make sense in most cases, except for GPU and similar performances or loops where it really shine. Since RISC already slowly coming and trying to take over CISC, most known softwares keep popping up for RISC, i just wanna see how many of you out there care about performance while programming little things and how much do you care for instruction sets.
Is This A Good Question/Topic? 0
  • +

Replies To: Are you using branchfree/branchless programming tactic and how often?

#2 DarenR   User is offline

  • D.I.C Lover

Reputation: 723
  • View blog
  • Posts: 4,660
  • Joined: 12-January 10

Re: Are you using branchfree/branchless programming tactic and how often?

Posted 15 July 2020 - 04:42 AM

you will find that most people use a mix depending on the amount of data and scale of the program
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7509
  • View blog
  • Posts: 25,287
  • Joined: 05-May 12

Re: Are you using branchfree/branchless programming tactic and how often?

Posted 16 July 2020 - 03:41 PM

Quote

“Programs must be written for people to read, and only incidentally for machines to execute.”
- Harold Abelson


I would also assume that a well written compiler will know if its target machine works better with no branches, or easy to predict branches and should structure the actual compiled code to run best on that target machine.

I will admit that for a short of period of time I was following a coding convention where I placed code that I anticipated to run more often in the else clause of an if-else statement. E.g. if's are detours from the happy path. When I found myself playing lots of games with De Morgan's Laws to keep instead of writing code that can be more easily read and understood, I stopped following that convention.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1