go time_test 源码

2022-07-15 浏览 (865)

golang time_test 代码

文件路径:/test/bench/go1/time_test.go

/ Copyright 2013 The Go Authors. All rights reserved.
/ Use of this source code is governed by a BSD-style
/ license that can be found in the LICENSE file.

package go1

/ benchmark based on time/time_test.go

import (
	"testing"
	"time"
)

func BenchmarkTimeParse(b *testing.B) {
	for i := 0; i < b.N; i++ {
		time.Parse(time.ANSIC, "Mon Jan  2 15:04:05 2006")
	}
}

func BenchmarkTimeFormat(b *testing.B) {
	t := time.Unix(1265346057, 0)
	for i := 0; i < b.N; i++ {
		t.Format("Mon Jan  2 15:04:05 2006")
	}
}

相关信息

go 源码目录

相关文章

go binarytree_test 源码

go fannkuch_test 源码

go fasta_test 源码

go fmt_test 源码

go gob_test 源码

go gzip_test 源码

go http_test 源码

go json_test 源码

go jsondata_test 源码

go mandel_test 源码

^