tdb 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +8 -0
- data/.gitignore +19 -0
- data/COPYING +165 -0
- data/GIT-VERSION-GEN +40 -0
- data/GNUmakefile +190 -0
- data/Hash_Functions +67 -0
- data/LICENSE +17 -0
- data/README +57 -0
- data/Rakefile +140 -0
- data/TODO +7 -0
- data/ext/tdb/djb.c +26 -0
- data/ext/tdb/extconf.rb +12 -0
- data/ext/tdb/fnv.c +28 -0
- data/ext/tdb/lookup3.c +429 -0
- data/ext/tdb/murmur1.c +151 -0
- data/ext/tdb/murmur2.c +290 -0
- data/ext/tdb/rbtdb.h +22 -0
- data/ext/tdb/tdb.c +690 -0
- data/lib/tdb.rb +2 -0
- data/setup.rb +1586 -0
- data/tdb.gemspec +36 -0
- data/test/test_tdb.rb +260 -0
- metadata +105 -0
data/.document
ADDED
data/.gitignore
ADDED
data/COPYING
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/GIT-VERSION-GEN
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
GVF=GIT-VERSION-FILE
|
4
|
+
DEF_VER=v0.0.0.GIT
|
5
|
+
|
6
|
+
LF='
|
7
|
+
'
|
8
|
+
|
9
|
+
# First see if there is a version file (included in release tarballs),
|
10
|
+
# then try git-describe, then default.
|
11
|
+
if test -f version
|
12
|
+
then
|
13
|
+
VN=$(cat version) || VN="$DEF_VER"
|
14
|
+
elif test -d .git -o -f .git &&
|
15
|
+
VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
|
16
|
+
case "$VN" in
|
17
|
+
*$LF*) (exit 1) ;;
|
18
|
+
v[0-9]*)
|
19
|
+
git update-index -q --refresh
|
20
|
+
test -z "$(git diff-index --name-only HEAD --)" ||
|
21
|
+
VN="$VN-dirty" ;;
|
22
|
+
esac
|
23
|
+
then
|
24
|
+
VN=$(echo "$VN" | sed -e 's/-/./g');
|
25
|
+
else
|
26
|
+
VN="$DEF_VER"
|
27
|
+
fi
|
28
|
+
|
29
|
+
VN=$(expr "$VN" : v*'\(.*\)')
|
30
|
+
|
31
|
+
if test -r $GVF
|
32
|
+
then
|
33
|
+
VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
|
34
|
+
else
|
35
|
+
VC=unset
|
36
|
+
fi
|
37
|
+
test "$VN" = "$VC" || {
|
38
|
+
echo >&2 "GIT_VERSION = $VN"
|
39
|
+
echo "GIT_VERSION = $VN" >$GVF
|
40
|
+
}
|
data/GNUmakefile
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
# use GNU Make to run tests in parallel, and without depending on RubyGems
|
2
|
+
all::
|
3
|
+
RUBY = ruby
|
4
|
+
RAKE = rake
|
5
|
+
RSYNC = rsync
|
6
|
+
GIT_URL = git://git.bogomips.org/ruby-tdb.git
|
7
|
+
|
8
|
+
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
9
|
+
@./GIT-VERSION-GEN
|
10
|
+
-include GIT-VERSION-FILE
|
11
|
+
-include local.mk
|
12
|
+
ifeq ($(DLEXT),) # "so" for Linux
|
13
|
+
DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts Config::CONFIG["DLEXT"]')
|
14
|
+
endif
|
15
|
+
ifeq ($(RUBY_VERSION),)
|
16
|
+
RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
|
17
|
+
endif
|
18
|
+
|
19
|
+
install:
|
20
|
+
$(prep_setup_rb)
|
21
|
+
$(RM) -r .install-tmp
|
22
|
+
mkdir .install-tmp
|
23
|
+
$(RUBY) setup.rb all
|
24
|
+
$(RM) $^
|
25
|
+
$(RM) -r .install-tmp
|
26
|
+
$(prep_setup_rb)
|
27
|
+
|
28
|
+
setup_rb_files := .config InstalledFiles
|
29
|
+
prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
|
30
|
+
|
31
|
+
clean:
|
32
|
+
-$(MAKE) -C ext/tdb clean
|
33
|
+
$(RM) $(setup_rb_files) ext/tdb/Makefile
|
34
|
+
|
35
|
+
pkg_extra := GIT-VERSION-FILE NEWS ChangeLog
|
36
|
+
manifest: $(pkg_extra)
|
37
|
+
$(RM) .manifest
|
38
|
+
$(MAKE) .manifest
|
39
|
+
|
40
|
+
.manifest:
|
41
|
+
(git ls-files && \
|
42
|
+
for i in $@ $(pkg_extra) $(man1_paths); \
|
43
|
+
do echo $$i; done) | LC_ALL=C sort > $@+
|
44
|
+
cmp $@+ $@ || mv $@+ $@
|
45
|
+
$(RM) $@+
|
46
|
+
|
47
|
+
NEWS: GIT-VERSION-FILE
|
48
|
+
$(RAKE) -s news_rdoc > $@+
|
49
|
+
mv $@+ $@
|
50
|
+
|
51
|
+
latest: NEWS
|
52
|
+
@awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' $<
|
53
|
+
|
54
|
+
SINCE =
|
55
|
+
ChangeLog: LOG_VERSION = \
|
56
|
+
$(shell git rev-parse -q "$(GIT_VERSION)" >/dev/null 2>&1 && \
|
57
|
+
echo $(GIT_VERSION) || git describe)
|
58
|
+
ifneq ($(SINCE),)
|
59
|
+
ChangeLog: log_range = v$(SINCE)..$(LOG_VERSION)
|
60
|
+
endif
|
61
|
+
ChangeLog: GIT-VERSION-FILE
|
62
|
+
@echo "ChangeLog from $(GIT_URL) ($(log_range))" > $@+
|
63
|
+
@echo >> $@+
|
64
|
+
git log $(log_range) | sed -e 's/^/ /' >> $@+
|
65
|
+
mv $@+ $@
|
66
|
+
|
67
|
+
news_atom := http://bogomips.org/ruby-tdb/NEWS.atom.xml
|
68
|
+
cgit_atom := http://git.bogomips.org/cgit/ruby-tdb.git/atom/?h=master
|
69
|
+
atom = <link rel="alternate" title="Atom feed" href="$(1)" \
|
70
|
+
type="application/atom+xml"/>
|
71
|
+
|
72
|
+
# using rdoc 2.5.x
|
73
|
+
doc: .document NEWS ChangeLog
|
74
|
+
rdoc -t "$(shell sed -ne '1s/^= //p' README)"
|
75
|
+
install -m644 COPYING doc/COPYING
|
76
|
+
install -m644 $(shell grep '^[A-Z]' .document) doc/
|
77
|
+
$(RUBY) -i -p -e \
|
78
|
+
'$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
|
79
|
+
doc/ChangeLog.html
|
80
|
+
$(RUBY) -i -p -e \
|
81
|
+
'$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
|
82
|
+
doc/NEWS.html doc/README.html
|
83
|
+
$(RAKE) -s news_atom > doc/NEWS.atom.xml
|
84
|
+
cd doc && ln README.html tmp && mv tmp index.html
|
85
|
+
|
86
|
+
ifneq ($(VERSION),)
|
87
|
+
rfproject := qrp
|
88
|
+
rfpackage := tdb
|
89
|
+
pkggem := pkg/$(rfpackage)-$(VERSION).gem
|
90
|
+
pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
|
91
|
+
release_notes := release_notes-$(VERSION)
|
92
|
+
release_changes := release_changes-$(VERSION)
|
93
|
+
|
94
|
+
release-notes: $(release_notes)
|
95
|
+
release-changes: $(release_changes)
|
96
|
+
$(release_changes):
|
97
|
+
$(RAKE) -s release_changes > $@+
|
98
|
+
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
99
|
+
$(release_notes):
|
100
|
+
GIT_URL=$(GIT_URL) $(RAKE) -s release_notes > $@+
|
101
|
+
$(VISUAL) $@+ && test -s $@+ && mv $@+ $@
|
102
|
+
|
103
|
+
# ensures we're actually on the tagged $(VERSION), only used for release
|
104
|
+
verify:
|
105
|
+
test x"$(shell umask)" = x0022
|
106
|
+
git rev-parse --verify refs/tags/v$(VERSION)^{}
|
107
|
+
git diff-index --quiet HEAD^0
|
108
|
+
test `git rev-parse --verify HEAD^0` = \
|
109
|
+
`git rev-parse --verify refs/tags/v$(VERSION)^{}`
|
110
|
+
|
111
|
+
fix-perms:
|
112
|
+
-git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
|
113
|
+
-git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
|
114
|
+
|
115
|
+
gem: $(pkggem)
|
116
|
+
|
117
|
+
install-gem: $(pkggem)
|
118
|
+
gem install $(CURDIR)/$<
|
119
|
+
|
120
|
+
$(pkggem): manifest fix-perms
|
121
|
+
gem build $(rfpackage).gemspec
|
122
|
+
mkdir -p pkg
|
123
|
+
mv $(@F) $@
|
124
|
+
|
125
|
+
$(pkgtgz): distdir = $(basename $@)
|
126
|
+
$(pkgtgz): HEAD = v$(VERSION)
|
127
|
+
$(pkgtgz): manifest fix-perms
|
128
|
+
@test -n "$(distdir)"
|
129
|
+
$(RM) -r $(distdir)
|
130
|
+
mkdir -p $(distdir)
|
131
|
+
tar cf - `cat .manifest` | (cd $(distdir) && tar xf -)
|
132
|
+
cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
|
133
|
+
mv $@+ $@
|
134
|
+
|
135
|
+
package: $(pkgtgz) $(pkggem)
|
136
|
+
|
137
|
+
test-release: verify package $(release_notes) $(release_changes)
|
138
|
+
release: verify package $(release_notes) $(release_changes)
|
139
|
+
# make tgz release on RubyForge
|
140
|
+
rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
|
141
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
|
142
|
+
# push gem to RubyGems.org
|
143
|
+
gem push $(pkggem)
|
144
|
+
# in case of gem downloads from RubyForge releases page
|
145
|
+
-rubyforge add_file \
|
146
|
+
$(rfproject) $(rfpackage) $(VERSION) $(pkggem)
|
147
|
+
$(RAKE) raa_update VERSION=$(VERSION)
|
148
|
+
else
|
149
|
+
gem install-gem: GIT-VERSION-FILE
|
150
|
+
$(MAKE) $@ VERSION=$(GIT_VERSION)
|
151
|
+
endif
|
152
|
+
|
153
|
+
ext := ext/tdb/tdb_ext.$(DLEXT)
|
154
|
+
ext/tdb/Makefile: ext/tdb/extconf.rb
|
155
|
+
cd $(@D) && $(RUBY) extconf.rb $(EXTCONF_ARGS)
|
156
|
+
|
157
|
+
$(ext): $(wildcard ext/tdb/*.[ch] ext/tdb/*/*.h) ext/tdb/Makefile
|
158
|
+
$(MAKE) -C $(@D)
|
159
|
+
|
160
|
+
all:: test
|
161
|
+
|
162
|
+
build: $(ext)
|
163
|
+
test_units := $(wildcard test/test_*.rb)
|
164
|
+
test: test-unit
|
165
|
+
test-unit: $(test_units)
|
166
|
+
$(test_units): build
|
167
|
+
$(RUBY) -I lib:ext/tdb $@
|
168
|
+
|
169
|
+
# this requires GNU coreutils variants
|
170
|
+
publish_doc:
|
171
|
+
-git set-file-times
|
172
|
+
$(RM) -r doc ChangeLog NEWS
|
173
|
+
$(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
|
174
|
+
$(MAKE) -s latest > doc/LATEST
|
175
|
+
find doc/images doc/js -type f | \
|
176
|
+
TZ=UTC xargs touch -d '1970-01-01 00:00:00' doc/rdoc.css
|
177
|
+
$(MAKE) doc_gz
|
178
|
+
chmod 644 $$(find doc -type f)
|
179
|
+
$(RSYNC) -av doc/ bogomips.org:/srv/bogomips/ruby-tdb/
|
180
|
+
git ls-files | xargs touch
|
181
|
+
|
182
|
+
# Create gzip variants of the same timestamp as the original so nginx
|
183
|
+
# "gzip_static on" can serve the gzipped versions directly.
|
184
|
+
doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
|
185
|
+
doc_gz:
|
186
|
+
touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
|
187
|
+
for i in $(docs); do \
|
188
|
+
gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
|
189
|
+
|
190
|
+
.PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test $(test_units)
|
data/Hash_Functions
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
= Brief overview of hash functions supported by Ruby TDB
|
2
|
+
|
3
|
+
Ruby TDB supports several alternative hash functions in addition to the
|
4
|
+
defaults supported by TDB upstream. Hash functions behave and perform
|
5
|
+
differently depending on the key and type of keys you use. We support
|
6
|
+
several popular hash functions (and will accept patches to support
|
7
|
+
more).
|
8
|
+
|
9
|
+
Changing hash functions on an already-created database will cause
|
10
|
+
corruption, so don't do it.
|
11
|
+
|
12
|
+
== TDB Upstream Defaults
|
13
|
+
|
14
|
+
* the default hash use by TDB is based on the hash algorithm from gdbm.
|
15
|
+
You may specify this by passing explicitly to TDB.new:
|
16
|
+
<code>:hash => :default</code>
|
17
|
+
|
18
|
+
* the new default (available via TDB::INCOMPATIBLE_HASH) is the Jenkins
|
19
|
+
{lookup3 hash}[http://www.burtleburtle.net/bob/c/lookup3.c].
|
20
|
+
<code>:hash => :jenkins_lookup3</code>
|
21
|
+
|
22
|
+
== Murmur family
|
23
|
+
|
24
|
+
The {Murmur}[https://sites.google.com/site/murmurhash/] family of hashes
|
25
|
+
are supported by Ruby TDB. MurmurHash3 will be supported as soon as it
|
26
|
+
becomes finalized. Most of these are not endian-neutral so databases
|
27
|
+
are no compatible between machines of different endianness and were
|
28
|
+
designed with x86 and x86_64 in mind (they may crash or not work on
|
29
|
+
other architectures).
|
30
|
+
|
31
|
+
* :murmur2 - the simple and fast implementation
|
32
|
+
|
33
|
+
* :murmur2a - words of the author:
|
34
|
+
|
35
|
+
This is a variant of MurmurHash2 modified to use the
|
36
|
+
Merkle-Damgard construction. Bulk speed should be identical to
|
37
|
+
Murmur2, small-key speed will be 10%-20% slower due to the added
|
38
|
+
overhead at the end of the hash.
|
39
|
+
|
40
|
+
This variant fixes a minor issue where null keys were more likely to
|
41
|
+
collide with each other than expected, and also makes the algorithm
|
42
|
+
more amenable to incremental implementations. All other caveats from
|
43
|
+
MurmurHash2 still apply.
|
44
|
+
|
45
|
+
* :murmur2_aligned - a safer, but slower variant of :murmur2 designed
|
46
|
+
for platforms where unaligned 4-byte reads can crash the machine.
|
47
|
+
|
48
|
+
* :murmur2_neutral - endian/alignment-neutral version of the simple
|
49
|
+
implementation, half as fast according to the author.
|
50
|
+
|
51
|
+
* :murmur1 - simple and fast historical version
|
52
|
+
|
53
|
+
* :murmur1_aligned - according to the author, the performance of this
|
54
|
+
one should be as good or better than the simple version.
|
55
|
+
|
56
|
+
== FNV family
|
57
|
+
|
58
|
+
* :fnv1a - the recommended variant of the popular
|
59
|
+
{Fowler-Noll-Vo}[http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash_function]
|
60
|
+
hash function
|
61
|
+
|
62
|
+
== Bernstein hashes
|
63
|
+
|
64
|
+
* :djb3 - The hash currently favored by Bernstein.
|
65
|
+
See http://www.cse.yorku.ca/~oz/hash.html
|
66
|
+
|
67
|
+
* :djb2 - See http://www.cse.yorku.ca/~oz/hash.html
|