+ $delMs = intval( 1e3 * ( microtime( true ) - $time_start ) );
+
+ $this->output(
+ " add: $add/$iterations {$addMs}ms " .
+ "set: $set/$iterations {$setMs}ms " .
+ "incr: $incr/$iterations {$incrMs}ms " .
+ "get: $get/$iterations ({$getMs}ms) " .
+ "delete: $delete/$iterations ({$delMs}ms)\n"
+ );
+ }
+
+ /**
+ * @param BagOStuff $mcc
+ * @param int $iterations
+ */
+ private function benchmarkMultiKeyOpsImmediateBlocking( $mcc, $iterations ) {
+ $keysByValue = [];
+ for ( $i = 1; $i <= $iterations; $i++ ) {
+ $keysByValue["test$i"] = 'S' . str_pad( $i, 2048 );
+ }
+ $keyList = array_keys( $keysByValue );
+
+ $time_start = microtime( true );
+ $mSetOk = $mcc->setMulti( $keysByValue ) ? 'S' : 'F';
+ $mSetMs = intval( 1e3 * ( microtime( true ) - $time_start ) );
+
+ $time_start = microtime( true );
+ $found = $mcc->getMulti( $keyList );
+ $mGetMs = intval( 1e3 * ( microtime( true ) - $time_start ) );
+ $mGetOk = 0;
+ foreach ( $found as $key => $value ) {
+ $mGetOk += ( $value === $keysByValue[$key] );
+ }
+
+ $time_start = microtime( true );
+ $mChangeTTLOk = $mcc->changeTTLMulti( $keyList, 3600 ) ? 'S' : 'F';
+ $mChangeTTTMs = intval( 1e3 * ( microtime( true ) - $time_start ) );
+
+ $time_start = microtime( true );
+ $mDelOk = $mcc->deleteMulti( $keyList ) ? 'S' : 'F';
+ $mDelMs = intval( 1e3 * ( microtime( true ) - $time_start ) );
+
+ $this->output(
+ " setMulti (IB): $mSetOk {$mSetMs}ms " .
+ "getMulti (IB): $mGetOk/$iterations {$mGetMs}ms " .
+ "changeTTLMulti (IB): $mChangeTTLOk {$mChangeTTTMs}ms " .
+ "deleteMulti (IB): $mDelOk {$mDelMs}ms\n"
+ );
+ }
+
+ /**
+ * @param BagOStuff $mcc
+ * @param int $iterations
+ */
+ private function benchmarkMultiKeyOpsDeferredBlocking( $mcc, $iterations ) {
+ $flags = $mcc::WRITE_BACKGROUND;
+ $keysByValue = [];
+ for ( $i = 1; $i <= $iterations; $i++ ) {
+ $keysByValue["test$i"] = 'A' . str_pad( $i, 2048 );
+ }
+ $keyList = array_keys( $keysByValue );
+
+ $time_start = microtime( true );
+ $mSetOk = $mcc->setMulti( $keysByValue, 0, $flags ) ? 'S' : 'F';
+ $mSetMs = intval( 1e3 * ( microtime( true ) - $time_start ) );
+
+ $time_start = microtime( true );
+ $found = $mcc->getMulti( $keyList );
+ $mGetMs = intval( 1e3 * ( microtime( true ) - $time_start ) );
+ $mGetOk = 0;
+ foreach ( $found as $key => $value ) {
+ $mGetOk += ( $value === $keysByValue[$key] );
+ }
+
+ $time_start = microtime( true );
+ $mChangeTTLOk = $mcc->changeTTLMulti( $keyList, 3600, $flags ) ? 'S' : 'F';
+ $mChangeTTTMs = intval( 1e3 * ( microtime( true ) - $time_start ) );
+
+ $time_start = microtime( true );
+ $mDelOk = $mcc->deleteMulti( $keyList, $flags ) ? 'S' : 'F';
+ $mDelMs = intval( 1e3 * ( microtime( true ) - $time_start ) );
+
+ $this->output(
+ " setMulti (DB): $mSetOk {$mSetMs}ms " .
+ "getMulti (DB): $mGetOk/$iterations {$mGetMs}ms " .
+ "changeTTLMulti (DB): $mChangeTTLOk {$mChangeTTTMs}ms " .
+ "deleteMulti (DB): $mDelOk {$mDelMs}ms\n"
+ );