54 $keys = array_merge( $exampleKeys, array_reverse( $exampleKeys ) );
59 if ( !$method || $method ===
'construct' ) {
60 $benches[
'HashBagOStuff::__construct'] = [
61 'function' =>
static function () use ( $max ) {
65 $benches[
'MapCacheLRU::__construct'] = [
66 'function' =>
static function () use ( $max ) {
72 if ( !$method || $method ===
'set' ) {
74 '@phan-var BagOStuff $hObj';
75 $benches[
'HashBagOStuff::set'] = [
76 'setup' =>
static function () use ( &$hObj, $max ) {
79 'function' =>
static function () use ( &$hObj, $keys ) {
80 foreach ( $keys as $i => $key ) {
81 $hObj->set( $key, $i );
86 '@phan-var MapCacheLRU $mObj';
87 $benches[
'MapCacheLRU::set'] = [
88 'setup' =>
static function () use ( &$mObj, $max ) {
91 'function' =>
static function () use ( &$mObj, $keys ) {
92 foreach ( $keys as $i => $key ) {
93 $mObj->set( $key, $i );
99 if ( !$method || $method ===
'get' ) {
101 '@phan-var BagOStuff $hObj';
102 $benches[
'HashBagOStuff::get'] = [
103 'setup' =>
static function () use ( &$hObj, $max, $keys ) {
105 foreach ( $keys as $i => $key ) {
106 $hObj->set( $key, $i );
109 'function' =>
static function () use ( &$hObj, $keys ) {
110 foreach ( $keys as $key ) {
116 '@phan-var MapCacheLRU $mObj';
117 $benches[
'MapCacheLRU::get'] = [
118 'setup' =>
static function () use ( &$mObj, $max, $keys ) {
120 foreach ( $keys as $i => $key ) {
121 $mObj->set( $key, $i );
124 'function' =>
static function () use ( &$mObj, $keys ) {
125 foreach ( $keys as $key ) {
132 $this->
bench( $benches );