It is a specialized data structure for storing a set of integers of type Int32.
Unlike the universal HashSet, numbers are not stored explicitly, but are packed into compact ordered structures. This allows you to save on the used RAM for large set sizes. In the worst case, the structure takes up ~525 MB in memory, while it can contain the full range of Int32 numbers. A hashset with such volumes consumes tens of gigabytes.
The structure implements the standard ISet interface, and can be used in all scenarios instead of HashSet. Also IntSet implements the IEnumerable interface, which enumerate numbers in ascending order without overhead.
The structure is designed as a Net Standard 2.1 library that can be used in any compatible projects.
To use it, install the nuget package:
Install-Package IntSet
using Kibnet;
var intSet = new IntSet();
intSet.Add(123);
var isContains = intSet.Contains(123);
intSet.Remove(123);
The repository has tests that show that everything works as it should.
I also have a code with benchmarks that shows superiority over HashSet in the operations of adding, deleting, and contains. I will publish it in this repository after I bring it to an acceptable form.