Oh wait, nevermind, I just realized looking at the screenshot I made that it was in vertex mode. Of course itās going to be the same speed. Sorry I didnāt notice, itās kinda hard to tell the difference once the mesh is that dense, got my hopes up. Still needs to be rewritten for Select Face by Area to be fast, what a dumb mistake, I was wondering what magic wand the devs had waved for BKE_mesh_wrapper_ensure_mdata(me);
to be cost free. Iād try to ninja edit but itās already too late
Anyways, hereās the actual results, the one that matters is the first one, it is slower by quite a bit in Area mode (0.7 seconds vs 0.3) because it has to copy the entire mesh. I think additional selections are the same because itās in memory or something.
Iāve also changed the way my additions to the patch deal with drawing the header button. The last build I did was pretty hacky and more inefficient that it appeared, but harmless enough to not really notice. So much so that I had never bothered testing how much it was costing. Long story short, I made everything user prefs rather than tool settings to fix this. If you are using Kioās build you donāt need to worry about any of this because it doesnāt have a header button to draw.
More info:
Blender doesnāt like checking a toolsetting bool every frame, so it acted a bit funny as far as not redrawing the viewport header when changing a tool setting or switching tools. But my select through viewport button needed to check these things so it would know whether to display the button or not, and if it was there, to draw it as either depressed/highlighted or not, again, depending what tool and tool settings were active. Because I was checking a tool setting bool, the state of the viewport header would be behind the times as far as tool(settings), and essentially show the user the opposite of what was going on:
If select through was on and then turned off by keyboard shortcut, the button would still be lit up, because it hadnāt redrawn itself yet. But once a selection was made or the mouse cursor left/entered the viewport, it would finally redraw itself properly. Useless.
So what I had done is change wm_draw to redraw the header every frame if the button was enabled. Basically, I made an assumption that checking one kind of bool is the same as checking any other, and since everything was using ToolSettings bools already, that what I was doing. The only way I could get the viewport header to redraw itself every frame without complete screwing up the view tabs and file menu by essentially hyper-drawing them into an invisible state, was to tell wm_draw to only redraw header areas that were also designated as overlapped, because only the viewport header was both a header area and overlapping something else.
But 3.0 changed the viewport header to not be overlapped anymore and it broke my precious hacky implementation of a āsmartā button. This was for the best though because it forced me to have a closer look at everything, and once I got it all working again, I looked at the cpu usage for the debug build inside Visual Studio, and saw that when the header button was enabled, it was using between 3-7% of cpu. Iām assuming this scales based on whatever cpu is being used, and for a 5800x to be using nearly 10% is definitely not insignificant, especially for a stupid little header button to light up or not for some select through visual feedback.
This is because tool setting bools are costly to check compared to user pref bools, probably for good reason but I have no idea. Solution was fortunately easy enough, just switch from tool settings to user prefs, and everything is back at 0% as far as Visual Studio is concerned, which is good enough for me. I could have kept some of the stuff like Face Select by Area in Xray as a tool setting because it has nothig to do with the button state, but Iām going to keep everything in one area unless someone really needs to assign these two or three things to keymap.
Forgot I was in Vertex Mode and made this post:
Ok so seems like good news as far as not needing a partial rewrite for speed/efficiency. From what Iām seeing select through is the same speed as vanilla xray like it was pre 2.83 or whatever version that was where select through face by area (as opposed to by facedot) got slower from needing BKE_mesh_wrapper_ensure_mdata(me);
Hereās a quick Lite build test I did. The vanilla build is the same besides adding a time printer to view3d_select.c
This is a 5800x cpu selecting a cube thatās been subdivided to 1.5 million faces in a Blender 3.0 beta Lite build. Low poly mesh act the same as vanilla as well. The first 3 and the last selection were made without having anything seleced. The 4th and 5th selection were made without deselecting the 1.5 million faces, so it adds that extra bit of time required to deselect.
If you want to see whatās up grab these diffs, build them both (I just did Lite because itās much faster) and compare, if it aināt what it seems and you got different results between the builds, let me know:
[Diff] 3.0 beta VANILLA timings
[Diff] 3.0 beta STHRU timings