40 $keys = array_merge( $exampleKeys, array_reverse( $exampleKeys ) );
45 if ( !$method || $method ===
'construct' ) {
46 $benches[
'HashBagOStuff::__construct'] = [
47 'function' =>
static function () use ( $max ) {
51 $benches[
'MapCacheLRU::__construct'] = [
52 'function' =>
static function () use ( $max ) {
58 if ( !$method || $method ===
'set' ) {
60 '@phan-var BagOStuff $hObj';
61 $benches[
'HashBagOStuff::set'] = [
62 'setup' =>
static function () use ( &$hObj, $max ) {
65 'function' =>
static function () use ( &$hObj, $keys ) {
66 foreach ( $keys as $i => $key ) {
67 $hObj->set( $key, $i );
72 '@phan-var MapCacheLRU $mObj';
73 $benches[
'MapCacheLRU::set'] = [
74 'setup' =>
static function () use ( &$mObj, $max ) {
77 'function' =>
static function () use ( &$mObj, $keys ) {
78 foreach ( $keys as $i => $key ) {
79 $mObj->set( $key, $i );
85 if ( !$method || $method ===
'get' ) {
87 '@phan-var BagOStuff $hObj';
88 $benches[
'HashBagOStuff::get'] = [
89 'setup' =>
static function () use ( &$hObj, $max, $keys ) {
91 foreach ( $keys as $i => $key ) {
92 $hObj->set( $key, $i );
95 'function' =>
static function () use ( &$hObj, $keys ) {
96 foreach ( $keys as $key ) {
102 '@phan-var MapCacheLRU $mObj';
103 $benches[
'MapCacheLRU::get'] = [
104 'setup' =>
static function () use ( &$mObj, $max, $keys ) {
106 foreach ( $keys as $i => $key ) {
107 $mObj->set( $key, $i );
110 'function' =>
static function () use ( &$mObj, $keys ) {
111 foreach ( $keys as $key ) {
118 $this->
bench( $benches );