Back in NYC, Yoel mentioned that creating lots of series (from existing arrays of key value pairs) was slow. This pull request improves the performance a bit (about 2x for lots of small series)
The bigger part of the change is using ReadOnlyCollection to pass keys around (so that they do not have to be always reconstructed from slow IEnumerable) and using arrays if we need to do a single projection (rather than using Seq.map followed by Array.ofSeq)
The other part of the change is avoiding too many lazy values in indices. Lazy values are relatively expensive to allocate (some small number of new object instances). We can instead just use mutable value that is initialized lazily inside the object when accessed (in principle, this is not thread-safe, but it is OK, because running the initialization repeatedly is fine).
Back in NYC, Yoel mentioned that creating lots of series (from existing arrays of key value pairs) was slow. This pull request improves the performance a bit (about 2x for lots of small series)
ReadOnlyCollection
to pass keys around (so that they do not have to be always reconstructed from slowIEnumerable
) and using arrays if we need to do a single projection (rather than usingSeq.map
followed byArray.ofSeq
)