SwiftCollections is a high-performance, memory-efficient library of collections designed for game development, simulations, and other performance-critical applications.
$ dotnet add package SwiftCollections![]()
SwiftCollections is a high-performance, memory-efficient library of collections designed for game development, simulations, and other performance-critical applications.
Clone the repository and add it to your project:
Install via NuGet:
Add SwiftCollections to your project using the following command:
dotnet add package SwiftCollections
Or Download/Clone:
Clone the repository or download the source code.
git clone https://github.com/mrdav30/SwiftCollections.git
Add to Project:
SwiftCollections project or its DLLs in your build process.SwiftCollections is now maintained as a separate Unity package. For Unity-specific implementations, refer to:
🔗 SwiftCollection-Unity Repository.
SwiftCollections depends on the following library:
This dependency is automatically included when installing.
var bvh = new SwiftBVH<int>(100);
var volume = new BoundingVolume(new Vector3(0, 0, 0), new Vector3(1, 1, 1));
bvh.Insert(1, volume);
var results = new List<int>();
bvh.Query(new BoundingVolume(new Vector3(0, 0, 0), new Vector3(2, 2, 2)), results);
Console.WriteLine(results.Count); // Output: 1
var array2D = new Array2D<int>(10, 10);
array2D[3, 4] = 42;
Console.WriteLine(array2D[3, 4]); // Output: 42
var queue = new SwiftQueue<int>(10);
queue.Enqueue(5);
Console.WriteLine(queue.Dequeue()); // Output: 5
var array = new int[10].Populate(() => new Random().Next(1, 100));
SwiftCollections includes a comprehensive suite of xUnit tests for validation.
To execute all unit tests, use the following command:
dotnet test -c debug
The library includes benchmarks to measure the performance of its collections. Benchmarks are powered by BenchmarkDotNet and can be run as follows:
Open the SwiftCollections.Benchmarks project.
Modify the Program.cs file to select the desired benchmark. Uncomment the relevant BenchmarkRunner lines.
using BenchmarkDotNet.Running;
namespace SwiftCollections.Benchmarks
{
class Program
{
static void Main(string[] args)
{
// Uncomment the benchmark you want to run:
// var ListIntegerBenchmarksSummary = BenchmarkRunner.Run<ListIntegerBenchmarks>();
var StackIntegerBenchmarksSummary = BenchmarkRunner.Run<StackIntegerBenchmarks>();
// var DictionaryStringBenchmarksSummary = BenchmarkRunner.Run<DictionaryStringBenchmarks>();
}
}
}
This project is licensed under the MIT License - see the LICENSE file
for details.
For questions or support, reach out to mrdav30 via GitHub or open an issue in the repository.