Skip to content
/ IntSet Public

This data structure is a set of integer values. It works 2 times faster than HashSet<int> and takes up much less memory.

Notifications You must be signed in to change notification settings

Kibnet/IntSet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IntSet IntSet

GitHub last commit

GitHub search hit counter Nuget GitHub code size in bytes

What is it?

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.

How to use?

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

Usage Example

using Kibnet;
var intSet = new IntSet();
intSet.Add(123);
var isContains = intSet.Contains(123);
intSet.Remove(123);

What is your proof?

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.

About

This data structure is a set of integer values. It works 2 times faster than HashSet<int> and takes up much less memory.

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Languages