mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 12:07:11 +01:00
30% Faster isHex for strings with 64 bytes.
This commit is contained in:
@@ -100,17 +100,7 @@ class HexBenchmark {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun newIsHex() {
|
||||
val isHexChar =
|
||||
BooleanArray(256).apply {
|
||||
"0123456789abcdefABCDEF".forEach { this[it.code] = true }
|
||||
}
|
||||
|
||||
r.measureRepeated {
|
||||
for (c in hex.indices) {
|
||||
if (!isHexChar[hex[c].code]) return@measureRepeated
|
||||
}
|
||||
return@measureRepeated
|
||||
}
|
||||
fun isHex64() {
|
||||
r.measureRepeated { Hex.isHex64(hex) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user