• Stars
    star
    109
  • Rank 311,627 (Top 7 %)
  • Language
    D
  • License
    Boost Software Li...
  • Created about 10 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Containers backed by std.experimental.allocator

Containers CI status

Containers backed by std.experimental.allocator

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")();
}

More Repositories

1

awesome-d

A curated list of awesome D documents, frameworks, libraries and software. Inspired by awesome-python.
D
640
star
2

DCD

The D Completion Daemon is an auto-complete program for the D programming language
D
345
star
3

D-Scanner

Swiss-army knife for D source code
D
236
star
4

dfmt

Dfmt is a formatter for D source code
D
202
star
5

SDLang-D

An SDLang (Simple Declarative Language) library for D
D
118
star
6

D-YAML

YAML parser and emitter for the D programming language
D
116
star
7

libdparse

Library for lexing and parsing D source code
D
113
star
8

drepl

A REPL for D
D
76
star
9

d2sqlite3

A small wrapper around SQLite for the D programming language
C
74
star
10

mecca

Weka.IO's userland OS
D
64
star
11

setup-dlang

Github action for dlang compiler setup
TypeScript
45
star
12

dfix

Tool for automatically upgrading D source code
D
44
star
13

std_data_json

Phobos candidate JSON implementation.
D
25
star
14

dmarkdown

Markdown to HTML processor for D
D
24
star
15

d-mans

Collection of D-Man drawings from around the world
HTML
20
star
16

DGrammar

An attempt to completely and correctly document the grammar of the D programming language
HTML
20
star
17

harbored-mod

A documentation generator for D with support for both DDoc and Markdown.
D
18
star
18

dsymbol

Basic symbol lookup/resolution for libdparse (Deprecated, see link)
D
15
star
19

quic-d

Implementation of QUIC in D. See: https://github.com/dlang/projects/issues/84
Nix
14
star
20

experimental.xml

A replacement of Phobos std.xml
D
11
star
21

discussions

Get in touch with the DLang community
11
star
22

stdx-allocator

Extracted std.experimental.allocator for usage via DUB
D
9
star
23

d-money

Handling amounts of money safely and efficiently
D
9
star
24

artwork

Collection of D artwork from around the world
HTML
8
star
25

tinyendian

Lightweight endianness library for D
D
8
star
26

libddoc

D implementation of the DDoc macro system
D
7
star
27

toml

D
4
star
28

configy

An automatic YAML to struct configuration parser for dlang
D
3
star
29

d-apt

Debian APT repository for D tools
2
star
30

gitcompatibledubpackage

An example of a repositery usable both as a DUB package and a git submodule.
D
2
star
31

decimal

1
star