[erlang-questions] Changing the representation of sets

Attila Rajmund Nohl <>
Tue Apr 25 13:17:44 CEST 2017


2017-04-25 8:51 GMT+02:00 Michał Muskała <>:
[...]
> My measurements [1] show that a set implementation based on maps is 2-4
> times faster in all operations than the current implementation from the sets
> module. Comparing performance tradeoffs to other set implementations, it
> seems that map-based sets have exactly the same characteristics as current
> sets, except they are faster. Map-based sets also have a huge advantage of
> being easily readable when printed in the console. Given the sets data
> structure is opaque it should be possible to just switch implementations and
> make everybody's code faster without changing a line of code. The only issue
> might be incorrect uses of the sets module that assume some particular shape
> for the structure - I'm not sure how widespread that is.

It would affect everybody who saves the opaque data using an earlier
OTP version, then reads it in newer OTP version (e.g. after upgrade).
Or those who run two nodes on different OTP versions (e.g. during an
upgrade).


More information about the erlang-questions mailing list