Greetings!
dry-equalizer 0.3.0 includes a change that adds a memoized hash method. Is there any reason not to enable this feature on Dry::Struct
?
E.g. replace this:
include Dry::Equalizer(:__attributes__)
with the following:
include Dry::Equalizer(:__attributes__, immutable: true)
Might break code for anyone (ab)using Dry::Struct
for mutable objects and expecting the hash
method to recalculate accordingly. Seems like a remote possibility.
I have a recursive data structure (a tree) that I model with Dry::Struct
subclass instances; by including the Dry::Equalizer
module as above directly in my subclasses, the average invocation of hash
dropped from 3.25 sec to under 20ms.