It doesn't allocate and it's half the time of time.Parse (which allocates), and 2/3rds the time of time.ParseInLocation (which doesn't). Go with a UTC time: BenchmarkGoParse3339/Z-8 2200995 534 ns/op 0 B/op 0 allocs/op BenchmarkGoParse3339/Z-8 2254816 554 ns/op 0 B/op 0 allocs/op BenchmarkGoParse3339/Z-8 2159504 522 ns/op 0 B/op 0 allocs/op Go allocates with a "-08:00" suffix instead of ending in "Z": BenchmarkGoParse3339/TZ-8 1276491 884 ns/op 144 B/op 3 allocs/op BenchmarkGoParse3339/TZ-8 1355858 942 ns/op 144 B/op 3 allocs/op BenchmarkGoParse3339/TZ-8 1385484 911 ns/op 144 B/op 3 allocs/op Go doesn't allocate if you use time.ParseInLocation, but then you need to parse the string to find the location anyway, so might as well go all the way (below). BenchmarkGoParse3339InLocation-8 1912254 597 ns/op 0 B/op 0 allocs/op BenchmarkGoParse3339InLocation-8 1980043 612 ns/op 0 B/op 0 allocs/op BenchmarkGoParse3339InLocation-8 1891366 612 ns/op 0 B/op 0 allocs/op Parsing RFC3339 ourselves, UTC: BenchmarkParse3339/Z-8 3889220 307 ns/op 0 B/op 0 allocs/op BenchmarkParse3339/Z-8 3718500 309 ns/op 0 B/op 0 allocs/op BenchmarkParse3339/Z-8 3621231 303 ns/op 0 B/op 0 allocs/op Parsing RFC3339 ourselves, with timezone (w/ *time.Location fetched from sync.Map) BenchmarkParse3339/TZ-8 3019612 418 ns/op 0 B/op 0 allocs/op BenchmarkParse3339/TZ-8 2921618 401 ns/op 0 B/op 0 allocs/op BenchmarkParse3339/TZ-8 3031671 408 ns/op 0 B/op 0 allocs/op Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Tailscale
Private WireGuard® networks made easy
Overview
This repository contains all the open source Tailscale code. It currently includes the Linux client.
The Linux client is currently cmd/relaynode
, but will
soon be replaced by cmd/tailscaled
.
Using
We serve packages for a variety of distros at https://pkgs.tailscale.com .
Building
go install tailscale.com/cmd/tailscale{,d}
We only guarantee to support the latest Go release and any Go beta or release candidate builds (currently Go 1.14) in module mode. It might work in earlier Go versions or in GOPATH mode, but we're making no effort to keep those working.
Bugs
Please file any issues about this code or the hosted service on the issue tracker.
Contributing
under_construction.gif
PRs welcome, but we are still working out our contribution process and tooling.
We require Developer Certificate of
Origin
Signed-off-by
lines in commits.
About Us
We are apenwarr, bradfitz, crawshaw, danderson, dfcarney, from Tailscale Inc. You can learn more about us from our website.
WireGuard is a registered trademark of Jason A. Donenfeld.