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

SwissDict #634

Merged
merged 67 commits into from
Aug 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
4002001
write initial code for SwissDict, add tests
eulerkochy Jun 14, 2020
eff12d4
Merge branch 'master' into swissdict
eulerkochy Jun 14, 2020
5ab6c06
undo changes in bench_robin_dict.jl
eulerkochy Jun 14, 2020
16ad2b8
clean code in swiss_dict.jl
eulerkochy Jun 16, 2020
30d7c2b
clean code in swiss_dict.jl
eulerkochy Jun 16, 2020
cc7e327
Merge branch 'swissdict' of https://github.com/eulerkochy/DataStructu…
eulerkochy Jun 16, 2020
3971b9d
fix runtests.jl
eulerkochy Jun 16, 2020
11b7406
shorten llvm.prefetch call
eulerkochy Aug 14, 2020
6442ad8
Add tests to increase coverage
eulerkochy Aug 14, 2020
ea52db5
match the behavior to Base.Dict, modify tests
eulerkochy May 24, 2020
35485ed
Update Project.toml
eulerkochy Jun 14, 2020
12ce458
Link to ColPrac
oxinabox Jun 22, 2020
d53806f
remove redundant iterate method
KristofferC Jun 24, 2020
27fbdd7
initial code for red-black tree
eulerkochy Jun 24, 2020
87fb04d
Add Base.copy,Base.copymutable for Sorted containers
NHDaly Jun 25, 2020
b86940b
Bump patch version number when adding Base.copy() overloads
NHDaly Jun 25, 2020
c8f0af1
Add test that copy/copymutable preserve type
NHDaly Jun 25, 2020
6886aa7
insert! working for RBTree
eulerkochy Jun 26, 2020
c7e9472
implement delete!, change ==, import Base.show
eulerkochy Jul 5, 2020
1ef2324
fix minor bugs in delete!, add tests
eulerkochy Jul 5, 2020
3c5bc53
add more tests, to cover cases by default
eulerkochy Jul 5, 2020
193cbf5
remove un-necessary code, add tests to improve coverage
eulerkochy Jul 7, 2020
ba272fe
fix tests for 0.7
eulerkochy Jul 7, 2020
937ec3f
handle cases related to insert
eulerkochy Jul 7, 2020
05f9fed
deprecate path for partial_path
oxinabox Jul 11, 2020
ec9611d
bump version
oxinabox Jul 11, 2020
b04a52e
Fix parametric initialisation of RBTree
eulerkochy Aug 2, 2020
3706cfc
change version to 0.18-DEV
oxinabox Jul 11, 2020
87d7be3
remove deprecations, including lingering references to `top`
oxinabox Jul 11, 2020
00ed4ae
remove ClassifiedCollections
oxinabox Jul 11, 2020
31d8397
Remove Julia 0.7 from Travis and AppVeyor
milesfrain Nov 27, 2019
29314f6
Use Base.Ordering for heap, and other performance improvements
milesfrain Sep 14, 2019
7512ff2
Add BinaryMinMaxHeap constructor for combined type and data
milesfrain Dec 3, 2019
33e7a49
ReverseOrdering() from Compat. Todo: Revert me later
milesfrain Nov 21, 2019
067ccde
Allow implicit conversion
milesfrain Jun 5, 2020
a312016
Address review
eulerkochy Aug 7, 2020
6dbc4a4
inbounds optimizations for CircularDeque and Circular Buffer
ancapdev Aug 9, 2020
f76fbde
remove include statement from robin_dict.jl
eulerkochy Aug 14, 2020
400b373
release 0.18
oxinabox Aug 17, 2020
35e394f
OrderedRobinDict
eulerkochy Aug 19, 2020
c6734b9
Add tests for uncovered lines in coverage
eulerkochy Aug 19, 2020
828412d
Update docs/src/robin_dict.md
eulerkochy Aug 20, 2020
094cf3e
Add functions, modify testset, address review
eulerkochy Aug 21, 2020
5bb477b
Fix typo in comments
eulerkochy Aug 21, 2020
8d1c685
condensed code for RobinDict benchmark
eulerkochy Aug 22, 2020
951da2a
export RBTree and deploy docs
eulerkochy Aug 22, 2020
62800ed
Update docs/src/red_black_tree.md
eulerkochy Aug 22, 2020
b7eb1d0
Apply suggestions from code review
eulerkochy Aug 22, 2020
7a7f50b
rebase to master, and apply code review suggestions
eulerkochy Aug 22, 2020
af5fe0e
Fix tests
eulerkochy Aug 22, 2020
2f866fe
final suggestions applied
eulerkochy Aug 22, 2020
0d6a826
bump version
eulerkochy Aug 23, 2020
8faf29b
Add RBTree to README.md
eulerkochy Aug 23, 2020
677c382
Fix typo in RBTree docstring
eulerkochy Aug 23, 2020
a7a836d
Fix the overloaded docs in v0.18.1
eulerkochy Aug 24, 2020
ee70afe
bump version
eulerkochy Aug 24, 2020
033a58c
write initial code for SwissDict, add tests
eulerkochy Jun 14, 2020
90109c4
undo changes in bench_robin_dict.jl
eulerkochy Jun 14, 2020
1f5801a
use prefetchr
eulerkochy Aug 14, 2020
a322c74
Merge branch 'master' into swissdict
eulerkochy Aug 28, 2020
ef3dbae
Merge branch 'master' into swissdict
eulerkochy Aug 29, 2020
6db72e7
add SwissDict to bench_dict, and improve benchmarks
eulerkochy Aug 29, 2020
2bb69d8
Merge branch 'swissdict' of https://github.com/eulerkochy/DataStructu…
eulerkochy Aug 29, 2020
e2bc9a4
add docstrings
eulerkochy Aug 29, 2020
954b55d
add SwissDict to docs
eulerkochy Aug 29, 2020
ccf9ab5
changes because of using instead of import
eulerkochy Aug 30, 2020
12582d0
fix tests, import length and isempty explicitly
eulerkochy Aug 30, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This package implements a variety of data structures, including
- Mutable Binary Heap
- Ordered Dicts and Sets
- RobinDict (implemented with [Robin Hood Hashing](https://cs.uwaterloo.ca/research/tr/1986/CS-86-14.pdf))
- SwissDict (inspired from [SwissTables](https://abseil.io/blog/20180927-swisstables))
- Dictionaries with Defaults
- Trie
- Linked List and Mutable Linked List
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ makedocs(
"ordered_containers.md",
"default_dict.md",
"robin_dict.md",
"swiss_dict.md",
"trie.md",
"linked_list.md",
"mutable_linked_list.md",
Expand Down
1 change: 1 addition & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This package implements a variety of data structures, including
- Mutable Binary Heap
- Ordered Dicts and Sets
- RobinDict and OrderedRobinDict (implemented with [Robin Hood Hashing](https://cs.uwaterloo.ca/research/tr/1986/CS-86-14.pdf))
- SwissDict (inspired from [SwissTables](https://abseil.io/blog/20180927-swisstables))
- Dictionaries with Defaults
- Trie
- Linked List and Mutable Linked List
Expand Down
43 changes: 43 additions & 0 deletions docs/src/swiss_dict.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
```@meta
DocTestSetup = :(using DataStructures)
```

# SwissDict

`SwissDict` provides a standard dictionary, conforming to the AbstractDict protocol, which is inspired from SwissTable developed by Google. This provides improved performance over Dict at extremely high Load Factor.

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

Examples:

```jldoctest
julia> d = RobinDict{Int, Char}(1 => 'a', 2 => 'b')
SwissDict{Int64,Char} with 2 entries:
1 => 'a'
2 => 'b'

julia> d[3] = 'c';

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

julia> delete!(d, 2);

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

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

julia> pop!(d)
1 => 'a'
```

```@meta
DocTestSetup = nothing
```
2 changes: 2 additions & 0 deletions src/DataStructures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module DataStructures
export MultiDict, enumerateall
export RobinDict
export OrderedRobinDict, isordered
export SwissDict

export DiBitVector

Expand Down Expand Up @@ -97,6 +98,7 @@ module DataStructures
include("container_loops.jl")
include("robin_dict.jl")
include("ordered_robin_dict.jl")
include("swiss_dict.jl")
export
CircularBuffer,
capacity,
Expand Down
1 change: 1 addition & 0 deletions src/ordered_robin_dict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ end
function get!(default::Base.Callable, h::OrderedRobinDict{K,V}, key0) where {K,V}
index = get(h.dict, key0, -2)
index > 0 && return @inbounds h.vals[index]

v = convert(V, default())
setindex!(h, v, key0)
return v
Expand Down