More efficient implementation of MutableLazyList.cs

Oct 5, 2009 at 7:02 PM

First of all: Good work and thanks. I'll certainly look more into the project.

The implementation of MutableLazyList could be improved in terms of memory and processor performance by changing the internal representation from

List<Option<T>> values;


T[] values;
BitArray evaluatedValues;

Especially for smaller value types, the difference will be huge.
(In the case of MutableLazyList<int>, it can be almost a factor of three (the actual reference/pointer is 64-bit, on 64-bit systems, right?).

For the common case of T being a class, and indexer always producing non-null values,
one can use simply "T[] values" as representation, and use values[i]==null to find out if an evaluation has occured.

Carry on the good work!

-> Anders