Skip to content
This repository has been archived by the owner on Jan 17, 2018. It is now read-only.
/ go-ulid Public archive

Universally Unique Lexicographically Sortable Identifier (ULID) in Go - Please use https://github.com/oklog/ulid

License

Notifications You must be signed in to change notification settings

darccio/go-ulid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Universally Unique Lexicographically Sortable Identifier

Project status Go Report Card GoDoc MIT licensed

alizain/ulid port to Golang (binary format implemented).

Why ULID?

Check out ULID's README.

About this implementation

Important: this repository has been archived. Please use oklog/ulid implementation.

I ported it to see how fast would be the same algorithm in Go. Also, it is cryptographically secure using crypto/rand.

Installation

go get github.com/imdario/go-ulid

Usage

import (
    "github.com/imdario/go-ulid"
)

// ...

u := ulid.New()

Performance

On a Intel Core 2 Duo 6600 @ 2.40 GHz, Windows 10 and Go 1.6.3:

BenchmarkULID-2                  1000000              1029 ns/op              16 B/op          1 allocs/op
BenchmarkEncodedULID-2           1000000              1249 ns/op              48 B/op          2 allocs/op
BenchmarkSingleEncodedULID-2    10000000               206 ns/op              32 B/op          1 allocs/op

Approx. 800.640 op/s, 46 times faster than Javascript original implementation.

How does it compare to UUID?

Using google/uuid:

BenchmarkUUID-2                  1000000              1041 ns/op              16 B/op          1 allocs/op
BenchmarkEncodedUUID-2           1000000              1407 ns/op              64 B/op          2 allocs/op
BenchmarkSingleEncodedUUID-2     5000000               302 ns/op              48 B/op          1 allocs/op

go-ulid is about 12% faster than Google's UUID!

About

Universally Unique Lexicographically Sortable Identifier (ULID) in Go - Please use https://github.com/oklog/ulid

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages