52 $keys = array_merge( $exampleKeys, array_reverse( $exampleKeys ) );
54 $method = $this->getOption(
'method' );
57 if ( !$method || $method ===
'construct' ) {
58 $benches[
'HashBagOStuff::__construct'] = [
59 'function' =>
static function () use ( $max ) {
63 $benches[
'MapCacheLRU::__construct'] = [
64 'function' =>
static function () use ( $max ) {
70 if ( !$method || $method ===
'set' ) {
72 '@phan-var BagOStuff $hObj';
73 $benches[
'HashBagOStuff::set'] = [
74 'setup' =>
static function () use ( &$hObj, $max ) {
77 'function' =>
static function () use ( &$hObj, $keys ) {
78 foreach ( $keys as $i => $key ) {
79 $hObj->set( $key, $i );
84 '@phan-var MapCacheLRU $mObj';
85 $benches[
'MapCacheLRU::set'] = [
86 'setup' =>
static function () use ( &$mObj, $max ) {
89 'function' =>
static function () use ( &$mObj, $keys ) {
90 foreach ( $keys as $i => $key ) {
91 $mObj->set( $key, $i );
97 if ( !$method || $method ===
'get' ) {
99 '@phan-var BagOStuff $hObj';
100 $benches[
'HashBagOStuff::get'] = [
101 'setup' =>
static function () use ( &$hObj, $max, $keys ) {
103 foreach ( $keys as $i => $key ) {
104 $hObj->set( $key, $i );
107 'function' =>
static function () use ( &$hObj, $keys ) {
108 foreach ( $keys as $key ) {
114 '@phan-var MapCacheLRU $mObj';
115 $benches[
'MapCacheLRU::get'] = [
116 'setup' =>
static function () use ( &$mObj, $max, $keys ) {
118 foreach ( $keys as $i => $key ) {
119 $mObj->set( $key, $i );
122 'function' =>
static function () use ( &$mObj, $keys ) {
123 foreach ( $keys as $key ) {
130 $this->bench( $benches );