Added caching to Option<T>.None to avoid unnecessary creation of objects to relieve pressure on GC.
Each Option is a Union<T, None> and each Union<T, None> is a pair of Dictionaries and a couple of Lambdas. Since there is no real need (I hope) to keep different instances of Option<T>.None, I decided to cache them. That helps in case your code "creates" a lot of Option<T>.None objects.
Added caching to
Option<T>.None
to avoid unnecessary creation of objects to relieve pressure on GC.Each Option is a
Union<T, None>
and eachUnion<T, None>
is a pair of Dictionaries and a couple of Lambdas. Since there is no real need (I hope) to keep different instances ofOption<T>.None
, I decided to cache them. That helps in case your code "creates" a lot ofOption<T>.None
objects.