Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • BIND BIND
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 528
    • Issues 528
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 103
    • Merge requests 103
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source Projects
  • BINDBIND
  • Issues
  • #2952

Closed
Open
Created Oct 14, 2021 by Ondřej Surý@ondrejOwner

Remove manual branch prediction using __builtin_expect()

A recent discussion on a MR has sparkled interesting question: Are the software developers better at guessing which branch is more likely to happen and does it help with performance? The GCC documentation on __builtin_expect() says:

In general, you should prefer to use actual profile feedback for this (-fprofile-arcs), as programmers are notoriously bad at predicting how their programs actually perform. However, there are applications in which this data is hard to collect.

Turns out that the documentation was right, we are notoriously bad at predicting how our program actually perform.

In the authoritative scenarios in the perflab, the (lo-hi from the last 15) results are:

Scenario main no-expect.
1k zones. 991,710 - 1,001,476 985,835 - 992,007
1M delegations 918,952 - 943,186 953,149 - 969,046
1M RRs 946,390 - 973,202 966,150 - 993,660
1M zones 963,561 - 991,627 984,624 - 998,857
root zone 427,566 - 469,889 460,026 - 473,576

In the recursive scenarios, the branch with disabled __builtin_expect() surpases the main branch:

_allruns-latency-since_30-until_60

_allruns-latency-since_30-until_60

Assignee
Assign to
Time tracking