• Stars
    star
    1,597
  • Rank 29,298 (Top 0.6 %)
  • Language
    Go
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

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

Repository Details

A Go implementation of the 64-bit xxHash algorithm (XXH64)

xxhash

Go Reference Test

xxhash is a Go implementation of the 64-bit xxHash algorithm, XXH64. This is a high-quality hashing algorithm that is much faster than anything in the Go standard library.

This package provides a straightforward API:

func Sum64(b []byte) uint64
func Sum64String(s string) uint64
type Digest struct{ ... }
    func New() *Digest

The Digest type implements hash.Hash64. Its key methods are:

func (*Digest) Write([]byte) (int, error)
func (*Digest) WriteString(string) (int, error)
func (*Digest) Sum64() uint64

The package is written with optimized pure Go and also contains even faster assembly implementations for amd64 and arm64. If desired, the purego build tag opts into using the Go code even on those architectures.

Compatibility

This package is in a module and the latest code is in version 2 of the module. You need a version of Go with at least "minimal module compatibility" to use github.com/cespare/xxhash/v2:

  • 1.9.7+ for Go 1.9
  • 1.10.3+ for Go 1.10
  • Go 1.11 or later

I recommend using the latest release of Go.

Benchmarks

Here are some quick benchmarks comparing the pure-Go and assembly implementations of Sum64.

input size purego asm
4 B 1.3 GB/s 1.2 GB/s
16 B 2.9 GB/s 3.5 GB/s
100 B 6.9 GB/s 8.1 GB/s
4 KB 11.7 GB/s 16.7 GB/s
10 MB 12.0 GB/s 17.3 GB/s

These numbers were generated on Ubuntu 20.04 with an Intel Xeon Platinum 8252C CPU using the following commands under Go 1.19.2:

benchstat <(go test -tags purego -benchtime 500ms -count 15 -bench 'Sum64$')
benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$')

Projects using this package

More Repositories

1

reflex

Run a command when files change
Go
3,151
star
2

vim-toml

Vim syntax for TOML
Vim Script
624
star
3

percpu

Best-effort CPU-local sharded values for Go
Go
190
star
4

ryu

A Go implementation of the Ryu algorithm for converting floating-point numbers to strings
Go
91
star
5

pastedown

Easy-to-use markdown-formatting pastebin
Go
90
star
6

prettybench

Format Go's benchmarking output
Go
87
star
7

go-smaz

A pure Go implementation of the smaz compression library for short strings.
Go
77
star
8

mph

Minimal perfect hashing in Go
Go
71
star
9

deplist

List the external dependencies of a Go package.
Go
63
star
10

gost

A largely compatible statsd daemon implementation in Go.
Go
55
star
11

goclj

Clojure parsing in Go
Go
37
star
12

go-tetris

A console-based tetris implementation in go.
Go
31
star
13

frosty

A raytracer, for fun
Go
24
star
14

saturday

A small SAT solver in Go
Go
23
star
15

markdownd

A markdown renderer and server for your command line.
Go
19
star
16

misc

Experiments and bad ideas
Go
19
star
17

stats

A commandline utility for summary statistics
Go
18
star
18

discoball

A simple stream filter to highlight patterns
Ruby
17
star
19

vim-sbd

Smart buffer closing. Mirror of repo by Orphée Lafond-Lummis.
Vim Script
17
star
20

vim-config

My personal vim configuration.
Vim Script
17
star
21

permute

Permutations for Go
Go
16
star
22

sub

Find/replace across files.
Go
14
star
23

vim-go-templates

Vim syntax highlighting for Go templates.
Vim Script
13
star
24

cbor

A Go implementation of CBOR (compact binary object representation).
Go
13
star
25

kvcache

An expiring key/value cache with a Redis interface
Go
11
star
26

go-localpath

Shell script for managing Go projects with vendored dependencies.
Shell
11
star
27

carlisle

Window control shortcuts for EWMH-compliant X window managers
Go
10
star
28

go-trie

A pure Go trie (prefix tree) implementation.
Go
8
star
29

dotfiles

Personal dotfiles, vim config, little scripts, etc.
Shell
8
star
30

pinion

A lightweight asset management system for Rack
Ruby
8
star
31

flake

Find test flakes
Go
6
star
32

playctrl

Control Google Play in Chrome via global shortcuts.
Go
6
star
33

boggle-solver

A simple boggle solver written for fun.
Ruby
6
star
34

ruby-dedent

A tiny addition to add a dedent method for Ruby strings
Ruby
6
star
35

vjde

Mirror of http://www.vim.org/scripts/script.php?script_id=1213
Vim Script
6
star
36

goproc

Parsing and tools for the Linux /proc pseudo-file system
Go
5
star
37

cp

File copying for Go
Go
5
star
38

tabular

Write tabular text
Go
5
star
39

sitkin

A static site generator.
Go
5
star
40

next

Experimental packages using generics
Go
5
star
41

diff

Go library for diffing files and readers.
Go
5
star
42

subcmd

A minimal Go package for CLI interfaces with sub-commands
Go
4
star
43

hprofviz

HProf output visualizer
Go
4
star
44

tsprefix

Prepend timestamps to each line of standard input
Go
4
star
45

jquery-ajax-retry

A simple jquery 'plugin' to retry ajax requests.
CoffeeScript
4
star
46

git-scripts

My personal git helper scripts
Ruby
4
star
47

assetserver

Go file server for web assets
Go
4
star
48

cron

A Go implementation of the cron scheduling format
Go
4
star
49

memstats

Go
4
star
50

tumblestone

Quick solver for tumblestone
Go
3
star
51

lp

list processes
Go
3
star
52

vim-bclose

Clone of bclose script.
Vim Script
3
star
53

mxml.vim

MXML syntax highlighting
Vim Script
3
star
54

flagconf

Easy TOML + flags configuration for Go programs.
Go
3
star
55

shadow

Expose Graphite metrics with an HTTP API
Go
3
star
56

go-apachelog

A logger for go servers that uses the apache common log format.
Go
3
star
57

gomaxprocs

A slightly better interface for accessing Go's runtime.GOMAXPROCS.
Go
3
star
58

deep_hash

A very small Ruby gem to manage multi-level default hashes.
Ruby
3
star
59

aoc2020

Advent of Code 2020
Go
3
star
60

glp

A code and dependency organization tool for Go
Go
2
star
61

argf

A Go implementation of Ruby's ARGF
Go
2
star
62

weave

Simple parallel SSH.
Ruby
2
star
63

hutil

Go net/http utilities.
Go
2
star
64

grb

go remote build
Go
2
star
65

kp

Keepass database manipulation
Go
2
star
66

guard-restarter

A Guard plugin to start something (like a server) and restart it when files change.
Ruby
2
star
67

window

Go package for maintaining a fixed window of a stream.
Go
2
star
68

ruby-complete

A ruby interface to bash command completion
Ruby
2
star
69

datef

Parse and print dates
Go
2
star
70

webtest

External copy of golang.org/x/website/internal/webtest
Go
2
star
71

jsonpath

Search for keys in nested JSON structures
Go
2
star
72

hmux

An HTTP muxer
Go
2
star
73

jquery-pixel-align

A jquery plugin to align SVGs to pixel boundaries.
HTML
2
star
74

git-heart

git ♥
1
star
75

usd

Go package for US Dollars
Go
1
star
76

cespare-brew-formulae

My personal brew formulae
Ruby
1
star
77

chunk

Read an arbitrary chunk from a file
Go
1
star
78

erebus

An easy-to-configure and flexible reverse routing proxy for development.
Go
1
star
79

githelpers

Helper tools for git
Go
1
star
80

fswatch

A small library to add a few features to github.com/fsnotify/fsnotify.
Go
1
star
81

dtd.vim

DTD syntax highlighting
Vim Script
1
star
82

wait

A Go package providing an extended version of sync.WaitGroup
Go
1
star
83

qs

Quickly take a screenshot and upload to Imgur (on Linux)
Shell
1
star
84

aoc2018

Advent of Code 2018
Go
1
star
85

ez-nginx-proxy

An nginx wrapper for simple reverse proxies in development.
Ruby
1
star
86

intelbacklight

An alternative for xbacklight that works with intel graphics
Go
1
star
87

pratbot

Go prat bot.
Go
1
star
88

srcstats

A source code analysis thing
Go
1
star
89

matasano

Solutions to the Matasano crypto challenges
Go
1
star
90

scrumcard

Planning Poker web app
JavaScript
1
star
91

cespare-snippets

Personal snipmate snippets
1
star
92

aoc2019

Advent of Code 2019
Go
1
star
93

rrproxy

A very simple routing reverse proxy built on Goliath.
Ruby
1
star
94

tlist

Minimal command-line TODO-list manager
Ruby
1
star