ObjC-CollapsingFutures icon indicating copy to clipboard operation
ObjC-CollapsingFutures copied to clipboard

Constant-time cleanup of callbacks

Open Strilanc opened this issue 11 years ago • 1 comments

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.

Strilanc avatar Jun 03 '14 08:06 Strilanc

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.

Strilanc avatar Jun 05 '14 04:06 Strilanc