modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/bench/go1/time_test.go (about) 1 // Copyright 2013 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package go1 6 7 // benchmark based on time/time_test.go 8 9 import ( 10 "testing" 11 "time" 12 ) 13 14 func BenchmarkTimeParse(b *testing.B) { 15 for i := 0; i < b.N; i++ { 16 time.Parse(time.ANSIC, "Mon Jan 2 15:04:05 2006") 17 } 18 } 19 20 func BenchmarkTimeFormat(b *testing.B) { 21 t := time.Unix(1265346057, 0) 22 for i := 0; i < b.N; i++ { 23 t.Format("Mon Jan 2 15:04:05 2006") 24 } 25 }