1
0
mirror of https://github.com/google/uuid.git synced 2025-02-20 12:33:21 +02:00

2 Commits

Author SHA1 Message Date
Bryan Matsuo
1c7b0fea16 opitimize json interface methods
A common helper function is used for UUID.String(), UUID.URN(), and
UUID.MarshalJSON().  Any perforance hit in UUID.String() and
UUID.Marshal() appears to be negligable.  The benefit to
UUID.MarshalJSON() is several hundred nanoseconds (23% faster) and 2
allocations (21% fewer bytes).

Some redundant checks are removed from UUID.UnmarshalJSON() method.  The
"encoding/json".Unmarshaler interface specifies that implementations can
assume input is valid JSON content.  This allows one to assume that (1)
input is not empty and (2) if index 0 is a quote, then the content is a
json string and the last index will contain a terminating quote.  The
second point is not completely explicit in the documentation but it is
true in practice (and it is safe to assume -- errors will be caught).
2015-10-10 22:08:33 -07:00
Paul Borman
2a573a0b4d Move code up one directory 2015-06-03 14:39:07 -07:00