Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OGL StreamBuffer optimization #461

Merged
merged 4 commits into from Jun 5, 2014

Conversation

degasus
Copy link
Member

@degasus degasus commented Jun 5, 2014

OGL::StreamBuffer was very high in profilation (2.5%), so here are some optimization for it.

  • Alloc fences directly in the StreamBuffer class, so they can't alias other member variables
  • Align the size by power of two and use shifting instead of divisions for slot calculation
  • Move alignment to the caller, so it can be skipped if not needed (eg indexbuffer)
  • Reduce index size to 32bit, faster alignment division

@neobrain
Copy link
Member

neobrain commented Jun 5, 2014

Don't use abbreviations in titles which show up in the commit log. Fix both the PR title and the commit messages.

Otherwise, LGTM.

The size of the buffer is now power of 2, so we can use a shift instead of a division.
This was at about 2% of the global CPU usage.
Only the caller know if alignment is needed at all, so it can be skipped now.
@degasus degasus changed the title Streambuffer opts OGL StreamBuffer optimization Jun 5, 2014
Yes, this matters.
We align our buffer all the the time which needs a division. u64 divisions are just so slow.
@degasus
Copy link
Member Author

degasus commented Jun 5, 2014

@neobrain done

neobrain added a commit that referenced this pull request Jun 5, 2014
@neobrain neobrain merged commit 40031c9 into dolphin-emu:master Jun 5, 2014
@degasus degasus deleted the streambuffer_opts branch June 5, 2014 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants