---
title: "定时器-性能测试"
url: "https://goframe.org/docs/components/os-gtimer-benchmark"
markdown_url: "https://goframe.org/docs/components/os-gtimer-benchmark.md"
locale: "zh-Hans"
version: "2.10.x(Latest)"
section: "组件列表"
category: "组件列表 / 系统相关 / 定时器-gtimer"
published: "2024-10-21"
updated: "2024-11-11"
description: "使用GoFrame框架在Linux环境下进行定时器性能测试的详细信息。通过对Benchmark_Add和Benchmark_StartStop的对比，能够更清晰地了解到定时器在不同操作下的效率和资源分配情况。测试结果显示出Go语言在执行定时器操作时的高效性能指标，从而为开发者在使用GoFrame中提供更好的参考。"
keywords: ["GoFrame", "GoFrame框架", "定时器", "性能测试", "Benchmark", "Go", "gtimer", "linux", "amd64", "github"]
---

# 定时器-性能测试

## 性能测试

```
goos: linux
goarch: amd64
pkg: github.com/gogf/gf/v2/os/gtimer
Benchmark_Add-12                         4048776               291.9 ns/op           249 B/op          6 allocs/op
Benchmark_StartStop-12                  100000000              10.96 ns/op             0 B/op          0 allocs/op
PASS
ok      command-line-arguments    6.602s
```
