On Fri Jun 2 15:38:27 2023 +0000, Alexandros Frantzis wrote:
This is another case of me copying what another driver is doing (wineandroid), expecting it to be a reasonable approach (and I think it basically is) :) If there are any concerns about this code, I am happy to replace it with a simple map implementation. Since I don't want to implement a custom hashtable just for this, I am tempted to use `rb_tree`. Although `rb_tree` won't be ideal for a small number of windows (high constant factors), it's readily available and has a good asymptotic behavior, so we won't choke if any app decides to create thousands of windows. As a side note, I am curious if there have ever been any thoughts or discussions about introducing a hashtable implementation in include/wine, since that would been a good match for this use case.
I think a `rb_tree` is a good solution as a starting point. If it proves to be ineffective for some reason it can always be changed later.
I can only suppose that a hash table have probably been discussed, but I think it is hard to write one that is at the same time simple, intrusive ptr based (and doesn't require external data), and header-only, like the rb tree and lists are.