Skip to content

Commit be2ca97

Browse files
committed
Update UtfStringBench.php
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent 905902c commit be2ca97

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

tests/benchmarks/UtfStringBench.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ class UtfStringBench
1818
* @Iterations(20)
1919
* @Revs(4)
2020
* @OutputTimeUnit("milliseconds")
21-
* @Assert("mode(variant.time.avg) < 100 milliseconds +/- 10%")
22-
* @Assert("mode(variant.time.avg) > 30 milliseconds +/- 10%")
21+
* @Assert("mode(variant.time.avg) < 40 milliseconds +/- 10%")
2322
*/
2423
public function benchBuildUtfString(): void
2524
{
@@ -34,4 +33,25 @@ public function setUp(): void
3433
$contentsPath = __DIR__ . '/../../LICENSE.txt';
3534
$this->testContents = (string) file_get_contents($contentsPath);
3635
}
36+
37+
/**
38+
* @Iterations(20)
39+
* @Revs(4)
40+
* @OutputTimeUnit("microseconds")
41+
* @Assert("mode(variant.time.avg) < 120 microseconds +/- 10%")
42+
*/
43+
public function benchUtfStringRandomAccessWithUnicode(): void
44+
{
45+
$text = 'abcdefghijklmnopqrstuvwxyz
46+
áéíóúýěřťǔǐǒǎšďȟǰǩľžčǚň
47+
🦋😄😃😀😊😉😍😘😚😗😂👿😮😨😱😠😡😤😖😆😋👯
48+
P\xf8\xed\xb9ern\xec \xbelu\xbbou\xe8k\xfd k\xf3d \xfap\xecl \xef\xe1belsk\xe9 k\xf3dy
49+
xℤⅿↈⅬ⅀ↆℜℝ⅗ℾ℧ⅰℓⅯⅵⅣ⅒21⅞';
50+
51+
$str1 = new UtfString($text);
52+
$str1->offsetGet(10);
53+
$str1->offsetGet(100);
54+
$str1->offsetGet(20);
55+
$str1->offsetGet(0);
56+
}
3757
}

0 commit comments

Comments
 (0)