Optims found while profiling, and dumb benchmark tool #1825

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
5 participants
Member

theuni commented Nov 21, 2012

This is just some hacking I did while profiling AE, looking for wasted cpu cycles. In the meantime I needed a way to test small changes and their impact on the CPU in some measurable way, this was the result. It's not particularly pretty, and only useful for internal testing, but it's better than nothing.

The 3 optims address the top 3 cpu consumers on their own. The result of some optimizing was a 5.8% decrease in average frame-time, excluding gpu operations as this was done with d-r+noflip on a static scene.

Just putting this out there for discussion, not for Frodo.

Cory Fields added some commits Nov 21, 2012

Cory Fields profile: Add a very dumb benchmark tool for profiling
At most, this lets us measure before/after frame-times when tweaking small but
busy parts of the codebase.
19082aa
Cory Fields profile: MULTI_INFO is hit ~75% of the time, make it the first check dd07646
Cory Fields profile: Cache controls' render regions to avoid the costly generateAABB eb20746
Cory Fields profile: stack.size() can be O(n) and these are done hundreds of time…
…s per frame. Keep track of the size instead.
d505fd0
Member

elupus commented Nov 21, 2012

It's using stack.size() pointlessly in som cases. empty() or first()!
=end() is much faster and smaller change.

Member

theuni commented Nov 21, 2012

@elupus Yup, my first thought was to just use .empty() instead, but since we need to be able to return the size in 2 places (including RemoveTransform(), which gets the most traffic) I opted for local storage. I'm happy to do that though if there's an issue with caching it, other than it being ugly and non-obvious.

Member

jmarshallnz commented Nov 22, 2012

You can probably kill the returning of the stack size in RemoveTransform. It's used only for debugging stuff, which has long been fixed. Instead, adding a function wrapped in _DEBUG to check the stack size might be a better way to go.

Member

elupus commented Feb 10, 2013

@theuni merge?

Member

jmarshallnz commented Feb 10, 2013

I've forced a rebase by fixing up the .empty/size stuff above in master.

Contributor

davilla commented Feb 26, 2013

Owner

MartijnKaijser commented Apr 5, 2013

closing for now as it's semi merged already

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment