Especially the add-search-sort combo, as done on both getmesh and addtexture, looked fatal.
So, I replaced the irrArray in meshcache with a red-black tree Addition slowed down about 5x, other operations gained. The add-search one gained a ton.
Though, nobody runs with this many meshes/textures, so even the loading time impact would be low in real scenarios.
Enjoy some thursday night geek porn:
Tree numbers:
Doing 1000 test rounds. Numbers in usecs.
Adding meshes: 8583
Searching: 4217
Deleting: 3831
Add-search cycles: 9179
Doing 1000 test rounds. Numbers in usecs.
Adding meshes: 15098
Searching: 4635
Deleting: 3818
Add-search cycles: 9105
Doing 1000 test rounds. Numbers in usecs.
Adding meshes: 11399
Searching: 4190
Deleting: 3849
Add-search cycles: 9048
Avg add: 11693 5.1
Avg search: 4347 0.65
Avg del: 3832 0.04
Avg a-s: 9110 0.007
Irr numbers:
Avg add: 2263
Avg search: 6613
Avg del: 89593
Avg a-s: 1260000
Doing 1000 test rounds. Numbers in usecs.
Adding meshes: 2256
Searching: 6155
Deleting: 86203
Add-search cycles: 1259400
Doing 1000 test rounds. Numbers in usecs.
Adding meshes: 2268
Searching: 7114
Deleting: 86568
Add-search cycles: 1264028
Doing 1000 test rounds. Numbers in usecs.
Adding meshes: 2267
Searching: 6570
Deleting: 96009
Add-search cycles: 1260852