Skip to content

Commit

Permalink
Merge pull request #27 from Cyan4973/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Cyan4973 committed Jun 29, 2015
2 parents dcc2ee1 + fcc8092 commit c7c4ae5
Show file tree
Hide file tree
Showing 6 changed files with 520 additions and 438 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
language: c
compiler: gcc
script: make test-all
script: make -B test-all
before_install:
- sudo apt-get update -qq
- sudo apt-get update -qq
- sudo apt-get install -qq gcc-arm-linux-gnueabi
- sudo apt-get install -qq clang
- sudo apt-get install -qq g++-multilib
- sudo apt-get install -qq gcc-multilib
- sudo apt-get install -qq valgrind

54 changes: 39 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ################################################################
# xxHash Makefile
# Copyright (C) Yann Collet 2012-2014
# Copyright (C) Yann Collet 2012-2015
#
# GPL v2 License
#
# This program is free software; you can redistribute it and/or modify
Expand All @@ -20,12 +21,12 @@
# You can contact the author at :
# - xxHash source repository : http://code.google.com/p/xxhash/
# ################################################################
# xxHash.exe : benchmark program, to demonstrate xxHash speed
# xxhsum : provides 32/64 bits hash of a file, or piped data
# ################################################################

CC := $(CC)
CFLAGS ?= -O3
CFLAGS += -I. -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes
CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -pedantic
FLAGS := -I. $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(MOREFLAGS)


# Define *.exe as extension for Windows systems
Expand All @@ -35,30 +36,53 @@ else
EXT =
endif

.PHONY: clean all

default: xxhsum

all: xxhsum xxhsum32

xxhsum: xxhash.c xxhsum.c
$(CC) $(CFLAGS) $^ -o $@$(EXT)
$(CC) $(FLAGS) $^ -o $@$(EXT)
ln -sf $@ xxh32sum
ln -sf $@ xxh64sum

xxhsum32: xxhash.c xxhsum.c
$(CC) -m32 $(CFLAGS) $^ -o $@$(EXT)

test: $(TEST_TARGETS)
$(CC) -m32 $(FLAGS) $^ -o $@$(EXT)

test: xxhsum
test: clean xxhsum
./xxhsum < xxhash.c
./xxhsum -b xxhash.c
valgrind --leak-check=yes ./xxhsum -bi1 xxhash.c
valgrind --leak-check=yes ./xxhsum -H0 xxhash.c
valgrind --leak-check=yes ./xxhsum -H1 xxhash.c
./xxhsum -bi1
./xxhsum -bi1 xxhash.c
valgrind --leak-check=yes --error-exitcode=1 ./xxhsum -bi1 xxhash.c
valgrind --leak-check=yes --error-exitcode=1 ./xxhsum -H0 xxhash.c
valgrind --leak-check=yes --error-exitcode=1 ./xxhsum -H1 xxhash.c

test32: clean xxhsum32
@echo ---- test 32-bits ----
./xxhsum32 -bi1 xxhash.c

armtest: clean
@echo ---- test ARM compilation ----
$(MAKE) xxhsum CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror"

clangtest: clean
@echo ---- test clang compilation ----
$(MAKE) all CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion"

gpptest: clean
@echo ---- test g++ compilation ----
$(MAKE) all CC=g++ CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror"

sanitize: clean
@echo ---- check undefined behavior - sanitize ----
$(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=undefined"

staticAnalyze: clean
@echo ---- static analyzer - scan-build ----
scan-build --status-bugs -v $(MAKE) all MOREFLAGS=-g

test-all: test xxhsum32
./xxhsum32 -b xxhash.c
test-all: test test32 armtest clangtest gpptest sanitize staticAnalyze

clean:
@rm -f core *.o xxhsum$(EXT) xxhsum32$(EXT) xxh32sum xxh64sum
Expand Down
77 changes: 33 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,62 @@ xxHash - Extremely fast hash algorithm
======================================

xxHash is an Extremely fast Hash algorithm, running at RAM speed limits.
It successfully passes the [SMHasher](http://code.google.com/p/smhasher/wiki/SMHasher) Test suite evaluating Hash quality.
It successfully completes the [SMHasher](http://code.google.com/p/smhasher/wiki/SMHasher) test suite
which evaluates collision, dispersion and randomness qualities of hash functions.

|Branch |Status |
|------------|---------|
|master | [![Build Status](https://travis-ci.org/Cyan4973/xxHash.svg?branch=master)](https://travis-ci.org/Cyan4973/xxHash?branch=master) |
|dev | [![Build Status](https://travis-ci.org/Cyan4973/xxHash.svg?branch=dev)](https://travis-ci.org/Cyan4973/xxHash?branch=dev) |

> **Branch Policy:**
> - The "master" branch is considered stable, at all times.
> - The "dev" branch is the one where all contributions must be merged
before being promoted to master.
> + If you plan to propose a patch, please commit into the "dev" branch,
or its own feature branch.
Direct commit to "master" are not permitted.


Benchmarks
-------------------------

The benchmark uses SMHasher speed test, compiled with Visual on a Windows Seven 32 bits system.
The benchmark uses SMHasher speed test, compiled with Visual 2010 on a Windows Seven 32-bits box.
The reference system uses a Core 2 Duo @3GHz

<table>
<tr>
<th>Name</th><th>Speed</th><th>Q.Score</th><th>Author</th>
</tr>
<tr>
<th>xxHash</th><th>5.4 GB/s</th><th>10</th><th>Y.C.</th>
</tr>
<tr>
<th>MumurHash 3a</th><th>2.7 GB/s</th><th>10</th><th>Austin Appleby</th>
</tr>
<tr>
<th>SBox</th><th>1.4 GB/s</th><th>9</th><th>Bret Mulvey</th>
</tr>
<tr>
<th>Lookup3</th><th>1.2 GB/s</th><th>9</th><th>Bob Jenkins</th>
</tr>
<tr>
<th>CityHash64</th><th>1.05 GB/s</th><th>10</th><th>Pike & Alakuijala</th>
</tr>
<tr>
<th>FNV</th><th>0.55 GB/s</th><th>5</th><th>Fowler, Noll, Vo</th>
</tr>
<tr>
<th>CRC32</th><th>0.43 GB/s</th><th>9</th><th></th>
</tr>
<tr>
<th>SipHash</th><th>0.34 GB/s</th><th>10</th><th>Jean-Philippe Aumasson</th>
</tr>
<tr>
<th>MD5-32</th><th>0.33 GB/s</th><th>10</th><th>Ronald L. Rivest</th>
</tr>
<tr>
<th>SHA1-32</th><th>0.28 GB/s</th><th>10</th><th></th>
</tr>
</table>

| Name | Speed | Quality | Author |
|---------------|----------|:-------:|------------------|
| xxHash | 5.4 GB/s | 10 | Y.C. |
| MurmurHash 3a | 2.7 GB/s | 10 | Austin Appleby |
| SBox | 1.4 GB/s | 9 | Bret Mulvey |
| Lookup3 | 1.2 GB/s | 9 | Bob Jenkins |
| CityHash64 | 1.05 GB/s| 10 | Pike & Alakuijala|
| FNV | 0.55 GB/s| 5 | Fowler, Noll, Vo |
| CRC32 | 0.43 GB/s| 9 | |
| MD5-32 | 0.33 GB/s| 10 | Ronald L.Rivest |
| SHA1-32 | 0.28 GB/s| 10 | |


Q.Score is a measure of quality of the hash function.
It depends on successfully passing SMHasher test set.
10 is a perfect score.
Algorithms with a score < 5 are not listed on this table.

A new version, XXH64, has been created thanks to Mathias Westerdahl contribution, which offers superior speed and dispersion for 64-bits systems. Note however that 32-bits applications will still run faster using the 32-bits version.
A new version, XXH64, has been created thanks to Mathias Westerdahl's contribution,
which offers superior speed and dispersion for 64-bits systems.
Note however that 32-bits applications will still run faster using the 32-bits version.

SMHasher speed test, compiled using GCC 4.8.2, a Linux Mint 64-bits.
SMHasher speed test, compiled using GCC 4.8.2, on Linux Mint 64-bits.
The reference system uses a Core i5-3340M @2.7GHz

| Version | Speed on 64-bits | Speed on 32-bits |
|------------|------------------|------------------|
| XXH64 | 13.8 GB/s | 1.9 GB/s |
| XXH32 | 6.8 GB/s | 6.0 GB/s |


This is an official mirror of xxHash project, [hosted on Google Code](http://code.google.com/p/xxhash/).
The intention is to offer github's capabilities to xxhash users, such as cloning, branch, pull requests or source download.

The "master" branch will reflect, the status of xxhash at its official homepage. The "dev" branch is the one where all contributions will be merged. If you plan to propose a patch, please commit into the "dev" branch. Direct commit to "master" are not permitted. Feature branches will also exist, typically to introduce new requirements, and be temporarily available for testing before merge into "dev" branch.
Beyond the C reference version,
xxHash is also available on many programming languages,
thanks to great contributors.
They are [listed here](https://code.google.com/p/xxhash/).
Loading

0 comments on commit c7c4ae5

Please sign in to comment.