Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RobinDict #501

Merged
merged 58 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
82fe9e5
Implement the constructors, model setindex! for RobinDict
eulerkochy May 8, 2019
7a3ae05
write basic form of rh_insert!
eulerkochy May 9, 2019
7fdc5ce
fix duplicate keys insertion
eulerkochy May 14, 2019
385c781
write getkey, haskey, iterate for RobinDict
eulerkochy May 14, 2019
da2b517
crude form of rh_delete, delete, pop, get
eulerkochy May 15, 2019
939e798
rehash! function, inspired by the base/dict.jl
eulerkochy May 20, 2019
3c3e24d
implement sizehint!
eulerkochy May 20, 2019
7f673e7
add comment about ROBIN_DICT_LOAD_FACTOR
eulerkochy May 20, 2019
30503df
add test for RobinDict
eulerkochy May 23, 2019
cacdf2a
Shift backwards, and change in rh_insert!
eulerkochy May 24, 2019
bd4e066
major changes in rehash!, corrected rh_delete!
eulerkochy May 28, 2019
6a74f9a
remove isslotdeleted 'cuz there ain't no tombstones! :tada:
eulerkochy May 28, 2019
b863818
add tests
eulerkochy May 28, 2019
c82257f
get function, and trying out grow_to! for dict_with_eltype
eulerkochy May 28, 2019
275bc63
test for RobinDict constructed from vararg of Pairs
eulerkochy May 29, 2019
c75fe3f
update get method, add tests
eulerkochy May 29, 2019
78df37d
write get! function for RobinDict
eulerkochy May 30, 2019
835288b
add tests for RobinDict
eulerkochy May 30, 2019
8c2acdc
fix a typo
eulerkochy May 30, 2019
73f47fe
add RobinDict to DataStructures.jl
eulerkochy May 30, 2019
bd8cf9e
remove extra rh_insert function
eulerkochy Jun 3, 2019
3b6ae45
attempt #1 : make the tests run
eulerkochy Jun 3, 2019
cd50239
add constructors
eulerkochy Jun 3, 2019
061240f
Modify test for type promotion
eulerkochy Jun 3, 2019
1483f01
Apply suggestions from code review
eulerkochy Jun 3, 2019
ec9ad8a
add tests
eulerkochy Jun 3, 2019
7098c1f
remove collect in ctor of AbstractDict
eulerkochy Jun 4, 2019
27514c5
changes to ROBIN_DICT_LOAD_FACTOR, and size parameter in L216
eulerkochy Jun 4, 2019
27e7118
add file for benchmarks
eulerkochy Jun 4, 2019
4bf15a6
change Int to Int8 for dibs array
eulerkochy Jun 4, 2019
7ab5c78
add benchmarks for size of order 10^5 entries
eulerkochy Jun 4, 2019
bfa33cd
change in parameter passed to rehash!
eulerkochy Jun 5, 2019
5f8fb15
storing hashes instead of dibs
eulerkochy Jun 14, 2019
30ea5be
write code for plots
eulerkochy Jun 17, 2019
59f5e0f
Apply suggestions from code review
eulerkochy Jun 19, 2019
8c9d8be
change in array reset to match Base, hash_key
eulerkochy Jun 24, 2019
bc635b8
Add filter! function
eulerkochy Jun 24, 2019
15a5e83
add empty for RobinDict, remove the forced conversion in ctor
eulerkochy Jun 24, 2019
8ee8caf
remove explicit writing of default ctor, make ctor for AbstractDict o…
eulerkochy Jun 24, 2019
9c9f41c
remove unnecessary comments, move ctor to outside of struct decln.
eulerkochy Jun 24, 2019
c3a45fd
write rh_insert_for_rehash, some change in benchmarking code
eulerkochy Jun 25, 2019
dfffad1
minor fix
eulerkochy Jun 25, 2019
70d0aa5
add tests for invariants, and filter function
eulerkochy Jun 26, 2019
057c58b
remove isslotfilled from test
eulerkochy Jun 26, 2019
433328d
add documentation for RobinDict
eulerkochy Jun 26, 2019
3bd850a
Add RobinDict to index.md
eulerkochy Jun 26, 2019
7df1c64
make the CI run :tada:
eulerkochy Jun 26, 2019
7cb71bf
include src file in test_robin_dict, so as to not export inner-functi…
eulerkochy Jun 26, 2019
bbfd1ee
add check_invariants
eulerkochy Jun 28, 2019
bf62078
modify an assertion
eulerkochy Jun 28, 2019
aaf3fdd
scrap totalcost, maxprobe
eulerkochy Jun 28, 2019
cd5b0ab
update test, check_invariants
eulerkochy Jun 28, 2019
89ad075
change hash_key and update tests
eulerkochy Jun 28, 2019
ceab89c
catching the bug-attempt 1
eulerkochy Jun 28, 2019
25225a6
hopefully, now it'll pass ! _/\_
eulerkochy Jun 28, 2019
de00dad
correcting a typo, correcting benchmarks
eulerkochy Jul 4, 2019
09827d5
Changes in robindict.md
eulerkochy Jul 4, 2019
d464edf
Update robin_dict.jl
eulerkochy Jul 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This package implements a variety of data structures, including
- Binary Heap
- Mutable Binary Heap
- Ordered Dicts and Sets
- RobinDict
- Dictionaries with Defaults
- Trie
- Linked List and Mutable Linked List
Expand All @@ -34,6 +35,7 @@ Pages = [
"heaps.md",
"ordered_containers.md",
"default_dict.md",
"robin_dict.md",
"trie.md",
"linked_list.md",
"mutable_linked_list.md"
Expand Down
36 changes: 36 additions & 0 deletions docs/src/robin_dict.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# RobinDict

`RobinDict` provides a standard dictionary, conforming to the AbstractDict protocol, which uses the Robin Hood hashing algorithm with backward-shift deletion to provide improved average performance over Dict.

The interface of `RobinDict` replicates that of `Dict`.

Examples:

```julia
eulerkochy marked this conversation as resolved.
Show resolved Hide resolved
julia> d = RobinDict{Int, Char}(1 => 'a', 2 => 'b')
RobinDict{Int64,Char} with 2 entries:
2 => 'b'
1 => 'a'

julia> d[3] = 'c';

julia> collect(d)
3-element Array{Pair{Int64,Char},1}:
2 => 'b'
3 => 'c'
1 => 'a'

julia> delete!(d, 2);

julia> d[1]
'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)

julia> d
RobinDict{Int64,Char} with 2 entries:
3 => 'c'
1 => 'a'

julia> pop!(d)
3 => 'c'
```

3 changes: 2 additions & 1 deletion src/DataStructures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module DataStructures
export orderobject, ordtype, Lt, compare, onlysemitokens

export MultiDict, enumerateall
export RobinDict

export findkey

Expand Down Expand Up @@ -90,7 +91,7 @@ module DataStructures
include("sorted_set.jl")
include("tokens2.jl")
include("container_loops.jl")

include("robin_dict.jl")
export
CircularBuffer,
capacity,
Expand Down
Loading