-
Notifications
You must be signed in to change notification settings - Fork 224
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
optimizations for selection performance #1419
Conversation
Focusing on reducing recomputation in Filter (e.g. reduce number of calls to EditorContext::visible(const Model::Brush* brush) ) MapView3D::doRenderMap is about 33% faster when making a selection on a large map.
btw, this was my benchmarking code:
|
Alright, will have a look soon. One thing though, can you please make sure that face selection still works, esp. with the correct edges being shown as selected? Because that might be affected by this change. |
I'm away from my PC for a few days, but will check on Wednesday |
Face selection (including rendering of selected edges) still looks correct with this. |
Excellent, thanks. |
The code is actually not ugly, but the control flow is a bit murky. I have mostly changed the names of the new classes / methods to reflect the new provider / acceptor nature of the control flow. Thanks for the contribution! |
I was messing around with #1404 a bit, tried some micro-optimization and got
MapView3D::doRenderMap
about 33% faster when making a selection on a large map.IMO there are two approaches to improving the selection performance:
MapRenderer::selectionDidChange
. (or partitioning the brushes into subsets, and only re-rendering the subsets containing the brushes that changed selection state). As you were saying in Selection performance on large maps #1404 , re-rendering only the exact set of changed brushes would interfere with OpenGL batching. It might be a performance win overall to forget about OpenGL batching.The code is certainly uglier with this change.. personally I'm not sure it's worth 33% better performance ;)
In particular, in the
doCollectShownFaces
implementations inMapRenderer.cpp
I inlined some bits of code fromEditorContext
. e.g. replacing per-face calls tovisible(const Model::BrushFace* face)
with checkingvisible(brush)
once, and using that, since the implementation ofvisible(const Model::BrushFace* face)
is:That's the worst thing.
Also, the CollectShownFaces/CollectShownEdges classes could be replaced with C++11 lambdas when TB switches to C++11.