用 zsh-bench 來測試 zsh 啟動速度

在調效 zsh 環境時 (使用 Prezto 取代 Oh-My-Zsh),找到一個算是簡單上手的效能測試工具 zsh-bench (https://github.com/romkatv/zsh-bench),在設定 prezto 時就是用它來比較各種設定下的 zsh 啟動速度。 執行 zsh-bench git clone 該 repo 1 git clone https://github.com/romkatv/zsh-bench 執行 zsh-bench ...

03 June 2024 · 2 min · nyo

如何寫 Go 的效能測試(Benchmark)

go 的測試工具 go test 有 benchmark 工具可以使用。 不用自己寫工具就可以很輕鬆的測試程式碼效能。 開始寫 benchmark 測試 建立 _test.go 結尾的檔案 function 要以 Benchmark 開頭 使用 b *testing.B 參數 將要測試的程式放到 b.N 的 for 迴圈內 範例如下: ...

15 July 2023 · 2 min · nyo