All Projects → dlang-community → Containers

dlang-community / Containers

Licence: bsl-1.0
Containers backed by std.experimental.allocator

Programming Languages

d
599 projects

Projects that are alternatives of or similar to Containers

Containers
This library provides various containers. Each container has utility functions to manipulate the data it holds. This is an abstraction as to not have to manually manage and reallocate memory.
Stars: ✭ 125 (+12.61%)
Mutual labels:  data-structures, array, set, containers
Mlib
Library of generic and type safe containers in pure C language (C99 or C11) for a wide collection of container (comparable to the C++ STL).
Stars: ✭ 321 (+189.19%)
Mutual labels:  array, set, hashmap
C Macro Collections
Easy to use, header only, macro generated, generic and type-safe Data Structures in C
Stars: ✭ 192 (+72.97%)
Mutual labels:  data-structures, hashmap, containers
Staticvec
Implements a fixed-capacity stack-allocated Vec alternative backed by an array, using const generics.
Stars: ✭ 236 (+112.61%)
Mutual labels:  data-structures, array, containers
Kind Of
Get the native JavaScript type of a value, fast. Used by superstruct, micromatch and many others!
Stars: ✭ 268 (+141.44%)
Mutual labels:  array, set
Javascript Datastructures Algorithms
📚 collection of JavaScript and TypeScript data structures and algorithms for education purposes. Source code bundle of JavaScript algorithms and data structures book
Stars: ✭ 3,221 (+2801.8%)
Mutual labels:  data-structures, set
Structurae
Data structures for high-performance JavaScript applications.
Stars: ✭ 323 (+190.99%)
Mutual labels:  data-structures, array
Wyhash
The FASTEST QUALITY hash function, random number generators (PRNG) and hash map.
Stars: ✭ 410 (+269.37%)
Mutual labels:  hashmap, fast
komihash
Very fast, high-quality hash function (non-cryptographic, C) + PRNG
Stars: ✭ 68 (-38.74%)
Mutual labels:  fast, hashmap
Semimap
A semi compile-/run-time associative map container with compile-time lookup and run-time storage
Stars: ✭ 335 (+201.8%)
Mutual labels:  hashmap, containers
Algodeck
An Open-Source Collection of 200+ Algorithmic Flash Cards to Help you Preparing your Algorithm & Data Structure Interview 💯
Stars: ✭ 4,441 (+3900.9%)
Mutual labels:  data-structures, array
js-collections-map-set
Repository to have example code to demonstrate JavaScript Map and Set data structures.
Stars: ✭ 21 (-81.08%)
Mutual labels:  set, data-structures
invokable
Objects are functions! Treat any Object or Class as a Proc (like Enumerable but for Procs).
Stars: ✭ 40 (-63.96%)
Mutual labels:  set, array
Data-Structures-and-Algorithms
Data Structures and Algorithms implementation in Python
Stars: ✭ 31 (-72.07%)
Mutual labels:  array, data-structures
Algorithm
Algorithm is a library of tools that is used to create intelligent applications.
Stars: ✭ 787 (+609.01%)
Mutual labels:  data-structures, set
Hashmap
HashMap JavaScript class for Node.js and the browser. The keys can be anything and won't be stringified
Stars: ✭ 363 (+227.03%)
Mutual labels:  array, hashmap
Leetcode
Provide all my solutions and explanations in Chinese for all the Leetcode coding problems.
Stars: ✭ 5,619 (+4962.16%)
Mutual labels:  data-structures, array
Geeksforgeeks Dsa 2
This repository contains all the assignments and practice questions solved during the Data Structures and Algorithms course in C++ taught by the Geeks For Geeks team.
Stars: ✭ 53 (-52.25%)
Mutual labels:  data-structures, array
Buckets Js
A complete, fully tested and documented data structure library written in pure JavaScript.
Stars: ✭ 1,128 (+916.22%)
Mutual labels:  data-structures, set
ctl
My variant of the C Template Library
Stars: ✭ 105 (-5.41%)
Mutual labels:  set, hashmap

Containers CI status

Containers backed by std.experimental.allocator

Dependencies

Run git submodule update --init --recursive after cloning this repository.

Documentation

Documentation is available at http://dlang-community.github.io/containers/index.html

Example

/+dub.sdl:
dependency "emsi_containers" version="~>0.6"
+/
import std.stdio;
void main(string[] args)
{
    import containers;
    DynamicArray!int arr;
    arr ~= 1;
    foreach (e; arr)
        e.writeln;
}

Open on run.dlang.io

Insertion Speed Benchmark

Benchmark

Measurements taken on a Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz with 8GB of memory. Compiled with dmd-2.068.0 using -O -release -inline flags.

Code

import containers.ttree;
import std.container.rbtree;
import containers.slist;
import std.container.slist;
import containers.unrolledlist;
import std.experimental.allocator;
import std.experimental.allocator.building_blocks.allocator_list;
import std.experimental.allocator.building_blocks.region;
import std.experimental.allocator.mallocator;
import std.datetime;
import std.stdio;

// For fun: change this number and watch the effect it has on the execution time
alias Allocator = AllocatorList!(a => Region!Mallocator(1024 * 16), Mallocator);

enum NUMBER_OF_ITEMS = 500_000;

void testEMSIContainer(alias Container, string ContainerName)()
{
	Allocator allocator;
	auto c = Container!(int, typeof(&allocator))(&allocator);
	StopWatch sw = StopWatch(AutoStart.yes);
	foreach (i; 0 .. NUMBER_OF_ITEMS)
		c.insert(i);
	sw.stop();
	writeln("Inserts for ", ContainerName, " finished in ",
		sw.peek().to!("msecs", float), " milliseconds.");
}

void testPhobosContainer(alias Container, string ContainerName)()
{
	static if (is(Container!int == class))
		auto c = new Container!int();
	else
		Container!int c;
	StopWatch sw = StopWatch(AutoStart.yes);
	foreach (i; 0 .. NUMBER_OF_ITEMS)
		c.insert(i);
	sw.stop();
	writeln("Inserts for ", ContainerName, " finished in ",
		sw.peek().to!("msecs", float), " milliseconds.");
}

void main()
{
	testEMSIContainer!(TTree, "TTree")();
	testPhobosContainer!(RedBlackTree, "RedBlackTree")();

	testPhobosContainer!(std.container.slist.SList, "Phobos SList")();
	testEMSIContainer!(containers.slist.SList, "EMSI SList")();

	testEMSIContainer!(UnrolledList, "UnrolledList")();
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].