mirror of
https://github.com/langgenius/dify-plugin-daemon.git
synced 2026-07-23 10:15:22 -04:00
2d216df27a
* feat: add benchmark workflow - Introduced a GitHub Actions workflow for benchmarking Go code, triggered on pushes to the main branch and pull requests. - Added a benchmark test for the stream package to measure performance of the Write method under concurrent conditions. * fix: setup license * fix: exclude non-benchmark * fix: stash license * chore: update triggers * update README
21 lines
252 B
Go
21 lines
252 B
Go
package stream
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func BenchmarkStream(b *testing.B) {
|
|
stream := NewStream[string](1)
|
|
go func() {
|
|
for stream.Next() {
|
|
stream.Read()
|
|
}
|
|
}()
|
|
|
|
for i := 0; i < b.N; i++ {
|
|
stream.Write("Hello, World!")
|
|
}
|
|
|
|
stream.Close()
|
|
}
|