Cache of the valid channel name regex
* Added a Benchmark to verify the performance * Now it is 10 times faster
This commit is contained in:
@@ -9,6 +9,18 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func BenchmarkGenerateSession(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
GenerateSessionID()
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkIsChannelNameValid(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
IsChannelNameValid("hello-world")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateSession(t *testing.T) {
|
||||
sessionID := GenerateSessionID()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user