zorael / kameloso

IRC bot with Twitch support
Boost Software License 1.0
9 stars 3 forks source link

Controllably rehashing AA #160

Closed zorael closed 1 year ago

zorael commented 1 year ago

Associative arrays are used in many places throughout the code. In some of these, additions of entries (new keys) happen very often, and such it makes sense to periodically rehash these to optimise access. This manual rehashing was replicated in some three places and was increasingly awkward.

This introduces a wrapper around associative arrays that allow us to controllably rehash them. It's very possible the underlying implementation rehashes itself as it grows, so this is just in addition to that.

It's mostly a drop-in replacement, except for some places with nested associative arrays (long[string][string]) that had to be coerced a bit.