Ejemplo n.º 1
0
<?php

require_once 'common.php';
class mock_set_peer extends redis_set_peer
{
}
# Benchmark
$p = new mock_set_peer();
bench_mark::start('Setting 10000 members');
$p->clear('bm_set');
for ($i = 0; $i < 10000; $i++) {
    $p->add('bm_set', md5($i));
}
bench_mark::stop();
bench_mark::start('Checking random member 10000 times');
for ($i = 0; $i < 10000; $i++) {
    $p->is_member('bm_set', md5($i));
}
bench_mark::stop();
bench_mark::start('Removing 10000 members');
$p->clear('bm_set');
for ($i = 0; $i < 10000; $i++) {
    $p->remove('bm_set', md5($i));
}
bench_mark::stop();
Ejemplo n.º 2
0
<?php

require_once 'common.php';
class mock_peer extends redis_peer
{
}
# Benchmark
$p = new mock_peer();
bench_mark::start('Setting 10000 entities');
for ($i = 0; $i < 10000; $i++) {
    $p->insert(array('data' => md5($i)));
}
bench_mark::stop();
bench_mark::start('Reading 10000 entities');
for ($i = 0; $i < 10000; $i++) {
    $p->get_by_id($i + 1);
}
bench_mark::stop();
bench_mark::start('Deleting 10000 entities');
for ($i = 0; $i < 10000; $i++) {
    $p->delete($i + 1);
}
bench_mark::stop();
Ejemplo n.º 3
0
<?php

require_once 'common.php';
class mock_list_peer extends redis_list_peer
{
}
# Benchmark
$p = new mock_list_peer();
bench_mark::start('Adding 10000 items to list');
$p->clear('list');
for ($i = 0; $i < 10000; $i++) {
    $p->insert('list', array('value' => md5($i), 'type' => rand(0, 1)));
}
bench_mark::stop();
bench_mark::start('Simple list retrievement 10000 times');
for ($i = 0; $i < 10000; $i++) {
    $p->get_list('list', null, rand(10, 20), rand(0, 500));
}
bench_mark::stop();