32 lines
778 B
TeX
32 lines
778 B
TeX
|
\chapter{基准测试}
|
|||
|
|
|||
|
\section{Go Test}
|
|||
|
|
|||
|
我们使用 Go Test 工具对成语接龙算法进行基准测试,结果如下:
|
|||
|
|
|||
|
\lstset{language = Bash, style = lgeneral}
|
|||
|
|
|||
|
\begin{lstlisting}
|
|||
|
goos: linux
|
|||
|
goarch: amd64
|
|||
|
pkg: yigedinglia-backend
|
|||
|
cpu: 13th Gen Intel(R) Core(TM) i5-13400F
|
|||
|
BenchmarkSolitaire
|
|||
|
BenchmarkSolitaire-16 114219 8939 ns/op
|
|||
|
PASS
|
|||
|
\end{lstlisting}
|
|||
|
|
|||
|
结果十分喜人,代表在最理想情况下,一次接龙操作耗时 8939 ns。
|
|||
|
|
|||
|
\section{Postman}
|
|||
|
|
|||
|
实际的生产环境不总是最理想的,以下为 Postman 的压力测试报告:
|
|||
|
|
|||
|
\begin{figure}[H]
|
|||
|
\centering
|
|||
|
\includegraphics[width=12cm]{postman.pdf}
|
|||
|
\caption{}
|
|||
|
\label{fig:postman}
|
|||
|
\end{figure}
|
|||
|
|
|||
|
报告显示,每秒能处理20.16个请求,平均每个请求耗时3ms。
|