Files
dify-plugin-daemon/internal/utils/stream/stream_benchmark_test.go
Yeuoly 2d216df27a feat: add benchmark workflow (#216)
* 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
2025-04-16 21:23:54 +08:00

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()
}