powered by nequal
Home » Net_TokyoTyrant » Timeline » 1121

Changeset 1121 -- 2009-08-18 02:15:31

Author
個々一η•ͺ
Comment
add pecl benchmark

Diffs

Net_TokyoTyrant/trunk/tests/benchmark/benchmark.php

@@ -1,5 +1,5 @@
<?php
-require_once dirname(dirname(__FILE__)) . '/Net/TokyoTyrant.php';
+require_once dirname(dirname(dirname(__FILE__))) . '/Net/TokyoTyrant.php';
require_once 'Benchmark/Timer.php';
$timer = new Benchmark_Timer();
$timer->start();

Net_TokyoTyrant/trunk/tests/benchmark/benchmark_pecl.php

@@ -0,0 +1,29 @@
+<?php
+//require_once dirname(dirname(__FILE__)) . '/Net/TokyoTyrant.php';
+require_once 'Benchmark/Timer.php';
+$timer = new Benchmark_Timer();
+$timer->start();
+
+$tt = new TokyoTyrant();
+$timer->setMarker('create');
+$tt->connect('localhost', 1978);
+$timer->setMarker('connect');
+
+
+$data = 'aaaaaaa';
+for($i = 0;$i <= 10000 ;$i++){
+   $key = (string) rand(1,100);
+   $tt->put($key, $data);
+}
+
+$timer->setMarker('put');
+
+for($i = 0;$i <= 10000 ;$i++){
+   $key = (string) rand(1,100);
+  $data = $tt->get($key);
+}
+
+$timer->setMarker('get');
+
+$timer->setMarker('close');
+$timer->display();