ObjC-CollapsingFutures
ObjC-CollapsingFutures copied to clipboard
Constant-time cleanup of callbacks
Currently, removing a callback can involve searching for it in an array. By using a doubly-linked list, or maybe just a hash table, the worst-case or at least expected times can be reduced from linear to constant.
It's probably not a good idea to use a hash table. Not only does it require a multiset instead of a set, but messing with the order things run in might break code that accidentally relied on ordering. Linked list or bust.