-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
40 lines (32 loc) · 737 Bytes
/
test.php
File metadata and controls
40 lines (32 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
use Utilitte\Php\Fiber\FiberLoop;
require __DIR__ . '/vendor/autoload.php';
function bench(callable $callback, ... $values) {
$ms = microtime(true);
for ($i = 0; $i < 1e4; $i++) {
$callback(...$values);
}
$ms = microtime(true) - $ms;
echo "Time: $ms\n";
}
var_dump(array_column([['asd' => 'xxx']], 'xxx'));
//bench(function ($values, $value) {
// foreach ($values as $key => $val) {
// if ($val === $value) {
// unset($values[$key]);
// }
// }
//
// return $values;
//}, ['val', 'xxx', 'wsd'], 'wsd');
//
//bench(function ($values, $value) {
// $ret = [];
// foreach ($values as $key => $val) {
// if ($val !== $value) {
// $ret[$key] = $val;
// }
// }
//
// return $ret;
//}, ['val', 'xxx', 'wsd'], 'wsd');