mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed?
<!-- Describe what has changed in this PR -->
Remove license header from every file. Because it is really hard to
follow in this PR here is the summary:
1. License header is removed from all `.go` and `.proto` files
:fireworks::fireworks:🎆.
2. `LICENSE` file in the root directory has only Temporal and Uber
copyrights.
3. 5 other `LICENSE` files added to the packages which have copyrights
different from Temporal and Uber: Datadog, Xargin, "Mat Ryer, Tyler
Bunnell and contributors".
4. `license_file` flag is removed from all code generation tools.
5. `copyright_file` flag is removed from `go:generate mockgen`
directive.
6. All copyright related targets are removed from `Makefile`.
7. Updated Temporal copyright year to 2025 everywhere.
## Why?
<!-- Tell your future self why have you made these changes -->
I double checked with legal department that it is not needed to have
license header in every file. One file per repo is enough. I put all
copyrights to the root `LICENSE` file and removed header from all other
files. Also updated tools and `Makefile`.
89 lines
2.7 KiB
Go
89 lines
2.7 KiB
Go
package dynamicconfig_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"go.temporal.io/server/common/dynamicconfig"
|
|
"go.temporal.io/server/common/log"
|
|
)
|
|
|
|
func BenchmarkCollection(b *testing.B) {
|
|
// client with just one value
|
|
client1 := dynamicconfig.StaticClient{
|
|
dynamicconfig.MatchingMaxTaskBatchSize.Key(): []dynamicconfig.ConstrainedValue{{Value: 12}},
|
|
}
|
|
cln1 := dynamicconfig.NewCollection(client1, log.NewNoopLogger())
|
|
b.Run("global int", func(b *testing.B) {
|
|
b.ReportAllocs()
|
|
for i := 0; i < b.N/2; i++ {
|
|
size := dynamicconfig.MatchingThrottledLogRPS.Get(cln1)
|
|
_ = size()
|
|
size = dynamicconfig.MatchingThrottledLogRPS.Get(cln1)
|
|
_ = size()
|
|
}
|
|
})
|
|
b.Run("namespace int", func(b *testing.B) {
|
|
b.ReportAllocs()
|
|
for i := 0; i < b.N/2; i++ {
|
|
size := dynamicconfig.HistoryMaxPageSize.Get(cln1)
|
|
_ = size("my-namespace")
|
|
size = dynamicconfig.WorkflowExecutionMaxInFlightUpdates.Get(cln1)
|
|
_ = size("my-namespace")
|
|
}
|
|
})
|
|
b.Run("taskqueue int", func(b *testing.B) {
|
|
b.ReportAllocs()
|
|
for i := 0; i < b.N/2; i++ {
|
|
size := dynamicconfig.MatchingMaxTaskBatchSize.Get(cln1)
|
|
_ = size("my-namespace", "my-task-queue", 1)
|
|
size = dynamicconfig.MatchingGetTasksBatchSize.Get(cln1)
|
|
_ = size("my-namespace", "my-task-queue", 1)
|
|
}
|
|
})
|
|
|
|
// client with more constrained values
|
|
client2 := dynamicconfig.StaticClient{
|
|
dynamicconfig.MatchingMaxTaskBatchSize.Key(): []dynamicconfig.ConstrainedValue{
|
|
{
|
|
Constraints: dynamicconfig.Constraints{
|
|
TaskQueueName: "other-tq",
|
|
},
|
|
Value: 18,
|
|
},
|
|
{
|
|
Constraints: dynamicconfig.Constraints{
|
|
Namespace: "other-ns",
|
|
},
|
|
Value: 15,
|
|
},
|
|
},
|
|
}
|
|
cln2 := dynamicconfig.NewCollection(client2, log.NewNoopLogger())
|
|
b.Run("single default", func(b *testing.B) {
|
|
b.ReportAllocs()
|
|
for i := 0; i < b.N/4; i++ {
|
|
size := dynamicconfig.MatchingMaxTaskBatchSize.Get(cln2)
|
|
_ = size("my-namespace", "my-task-queue", 1)
|
|
size = dynamicconfig.MatchingMaxTaskBatchSize.Get(cln2)
|
|
_ = size("my-namespace", "other-tq", 1)
|
|
size = dynamicconfig.MatchingMaxTaskBatchSize.Get(cln2)
|
|
_ = size("other-ns", "my-task-queue", 1)
|
|
size = dynamicconfig.MatchingMaxTaskBatchSize.Get(cln2)
|
|
_ = size("other-ns", "other-tq", 1)
|
|
}
|
|
})
|
|
b.Run("structured default", func(b *testing.B) {
|
|
b.ReportAllocs()
|
|
for i := 0; i < b.N/4; i++ {
|
|
size := dynamicconfig.MatchingNumTaskqueueWritePartitions.Get(cln2)
|
|
_ = size("my-namespace", "my-task-queue", 1)
|
|
size = dynamicconfig.MatchingNumTaskqueueWritePartitions.Get(cln2)
|
|
_ = size("my-namespace", "other-tq", 1)
|
|
size = dynamicconfig.MatchingNumTaskqueueWritePartitions.Get(cln2)
|
|
_ = size("other-ns", "my-task-queue", 1)
|
|
size = dynamicconfig.MatchingNumTaskqueueWritePartitions.Get(cln2)
|
|
_ = size("other-ns", "other-tq", 1)
|
|
}
|
|
})
|
|
}
|