Closed
Description
VBuffer
is a very critical, fundamental type in ML.NET. And as such, it has some critical performance considerations and characteristics it needs to adhere to.
However, it is not as intuitive of a type as it could be. We even wrote a Care and Feeding doc that describes some common pitfalls and other things to be aware of when using the type.
At its core, VBuffer
has 2 responsibilities:
- It is a vector that can be either dense or sparse.
- It is a reusable/cached "buffer" to allow minimal allocations and garbage collections.
We should do some investigation into what types of improvements we can make to this type.
- Is there something "base class library"-ish that can be introduced in .NET that would make this type better?
- Potentially can we use
ArrayPool
to take care of the "buffer"-ness? (see https://github.com/dotnet/corefx/issues/4547) - Are there other BCL types we could use or introduce?
- Potentially can we use
- Are there alternative API designs that we should consider/incorporate here to make the type more intuitive and less error prone by users?
- i.e. should some members be encapsulated?
- Should we split
VBuffer
into two typesSparseVector
andDenseVector
?
/cc @TomFinley @Zruty0