1
0
mirror of https://github.com/google/uuid.git synced 2024-11-24 08:32:23 +02:00
Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.
Go to file
Bryan Matsuo 7508f98c71 optimize internal parsing function -- avoid unsafe []byte parsing
Making xtob take two byte arguments avoids a lot of slicing.  This makes
the Parse function faster.  In addition, because so much slicing is
avoiding, duplicating the parse logic to ParseBytes resulted in the
function being faster than Parse (<1ns).

The BenchmarkParseBytesNative function has been removed (parseBytes was
identical to ParseBytes).  And a new benchmark,
BenchmarkParseBytesUnsafe, has been added to benchmark the old way of
parsing []byte (which is slightly slower than Parse and thus the new
ParseBytes implementation).

    benchmark                         old ns/op     new ns/op     delta
    BenchmarkUUID_MarshalJSON-4       685           667           -2.63%
    BenchmarkUUID_UnmarshalJSON-4     1145          1162          +1.48%
    BenchmarkParse-4                  61.6          56.5          -8.28%
    BenchmarkParseBytes-4             65.7          55.9          -14.92%
    BenchmarkParseBytesCopy-4         121           115           -4.96%
    BenchmarkNew-4                    1665          1643          -1.32%
    BenchmarkUUID_String-4            112           113           +0.89%
    BenchmarkUUID_URN-4               117           119           +1.71%

    benchmark                         old allocs     new allocs     delta
    BenchmarkUUID_MarshalJSON-4       4              4              +0.00%
    BenchmarkUUID_UnmarshalJSON-4     2              2              +0.00%
    BenchmarkParse-4                  0              0              +0.00%
    BenchmarkParseBytes-4             0              0              +0.00%
    BenchmarkParseBytesCopy-4         1              1              +0.00%
    BenchmarkNew-4                    1              1              +0.00%
    BenchmarkUUID_String-4            1              1              +0.00%
    BenchmarkUUID_URN-4               1              1              +0.00%

    benchmark                         old bytes     new bytes     delta
    BenchmarkUUID_MarshalJSON-4       248           248           +0.00%
    BenchmarkUUID_UnmarshalJSON-4     248           248           +0.00%
    BenchmarkParse-4                  0             0             +0.00%
    BenchmarkParseBytes-4             0             0             +0.00%
    BenchmarkParseBytesCopy-4         48            48            +0.00%
    BenchmarkNew-4                    16            16            +0.00%
    BenchmarkUUID_String-4            48            48            +0.00%
    BenchmarkUUID_URN-4               48            48            +0.00%
2016-02-25 21:48:37 -08:00
.travis.yml Add travis-ci configuration for testing. 2016-02-09 10:27:59 -08:00
CONTRIBUTING.md Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
CONTRIBUTORS Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
dce.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
doc.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
hash.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
json_test.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
LICENSE Move code up one directory 2015-06-03 14:39:07 -07:00
marshal.go optimize internal parsing function -- avoid unsafe []byte parsing 2016-02-25 21:48:37 -08:00
node.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
README.md Update readme to make sure people know the API might change. 2016-02-19 12:57:29 -08:00
seq_test.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
sql_test.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
sql.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
time.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
util.go optimize internal parsing function -- avoid unsafe []byte parsing 2016-02-25 21:48:37 -08:00
uuid_test.go optimize internal parsing function -- avoid unsafe []byte parsing 2016-02-25 21:48:37 -08:00
uuid.go optimize internal parsing function -- avoid unsafe []byte parsing 2016-02-25 21:48:37 -08:00
version1.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
version4.go Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00

This package is currently in development and the API may not be stable.

The API will become stable with v1.

uuid build status

The uuid package generates and inspects UUIDs based on RFC 412 and DCE 1.1: Authentication and Security Services.

This package is based on the github.com/pborman/uuid package (previously named code.google.com/p/go-uuid). It differs from these earlier packages in that a UUID is a 16 byte array rather than a byte slice. One loss due to this change is the ability to represent an invalid UUID (vs a NIL UUID).

Install

go get github.com/google/uuid

Documentation

GoDoc

Full go doc style documentation for the package can be viewed online without installing this package by using the GoDoc site here: http://godoc.org/github.com/google/uuid