-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Scene#drillPick performance scales poorly #9660
Comments
I found a few similar posts about I also found #1592 , from 7 years ago (!), where people have been asking for a way to mark entities as "unpickable". In my actual use case I do have some entities that are marked for "never-select". These are filtered out after |
I'm also having this problem. In my case, there are thousands of Polygons, but selecting a region with about 100 takes 5 seconds. If I select more than 400, the page gets unresponsive and sometimes it crashes. I also have a warning saying :
I didn't understand why it toggles the visibility for this feature to work yet. But maybe this is slowing the process down. Changing the material of the whole dataSource in a for loop takes about 3 seconds more than selecting only a small part (less than 0.001%) with drillPick. If anyone has a hint on what needs to be done, please let me know. |
Sandcastle example: Open, then click anywhere on the map to select between the top-left corner of the canvas and the clicked location. The console tab will log the number of pins included (to make sure the correct point was used) and the time in milliseconds spent in the call to
drillPick
.Browser: Chrome stable, latest
Operating System: Win10 latest
There are 2 related problems here.
First, try zooming and scrolling such that you have a few pins (say 3x3 to 5x5 square) in the top left corner (say 200x200 px or so). On my machine I can pick 9 pins in a 150x150px region in 70ms. Now, without moving the camera, click close to the bottom right corner. On my machine that was a 900x600px region with 228 pins -- and the call locked the main thread for a full 8 seconds (!). By contrast a pick with the same region (900x600px) only takes 50ms if there are no pins in it.
Second, zoom way out so that most of the pins are huddled in the top-left corner. I'm able to get all 400 pins in a 150x150px region, and it "only" takes 1400ms -- a lot longer than 9 pins in the same region, but a lot shorter than the same number of pins in a much larger region.
So, it seems that drillPick runtime scales by both the size of the region being considered, and the number of entities in the region, but neither relationship is linear. I'm hoping somebody has some bright ideas to improve performance, but I'd also welcome suggestions for going about this another way. I've seen suggestions to derive a
Rectangle
representing the selected region, then check the Entity position usingcontains
, but that scales poorly compared todrillPick
if most of your Entities are offscreen, and also doesn't handle the case of Entities that don't need aposition
e.g. because they just use non-relative Graphics likepolygon
/polyLine
/ etc.The text was updated successfully, but these errors were encountered: