BlueMountainCapital/Deedle — pull request #268 by tpetricek (2014-09-12 21:14:39+00:00)
Title: Improve performance of series construction

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).