Git Product home page Git Product logo

Comments (7)

laruence avatar laruence commented on May 31, 2024

hey, so you are running the test script in a single process?

from yac.

AnonSphere avatar AnonSphere commented on May 31, 2024

My yac.ini:

extension=yac.so
yac.enable = 1
yac.keys_memory_size = 4M
yac.values_memory_size = 64M
yac.compress_threshold = -1

So maybe yes. :-)

from yac.

laruence avatar laruence commented on May 31, 2024

yac is no lock cache, that means, if you run the test scripts in multi-processes(which is the common usage, like ab -n 1000 -c 50 ) then the performance advantage will show up.. :)

and thanks for the info about shorter key length. I will look into it.

thanks

from yac.

AnonSphere avatar AnonSphere commented on May 31, 2024

Ah, sorry - you meant if I make a benchmark on the script, I will see the difference? That might be correct. Currently I just tried with a single process on a smaller project, where the values does not change often. But I will try this out. Thank you! 👍

from yac.

laruence avatar laruence commented on May 31, 2024

you are welcome, any feedback is appreciated :)

from yac.

benbender avatar benbender commented on May 31, 2024

Is there any real explanation why apc should be faster with longer keys or is this only statistical variation on those tests? For me it sounds quite strange that apc should be percentually so much faster only by using longer keys... could you rerun your tests f.e. 1000 times and build median values too proof your results?

from yac.

AnonSphere avatar AnonSphere commented on May 31, 2024

@benbender I can't tell you why, but the key length has an effect on the benchmark results in apc. See

apc_clear_cache();

$start = microtime(true);
for ($i = 0; $i<10000; $i++) {
$key = "xxx".rand(1,100);
$value = str_repeat("x", rand(1, 1000));

if (!apc_store($key, $value)) {
    var_dump("write " . $i);
}

if ($value != ($new = apc_fetch($key))) {
    var_dump("read " . $i);
}
}
echo (microtime(true)-$start).'<br />';

apc_clear_cache();

$start = microtime(true);
for ($i = 0; $i<10000; $i++) {
$key = "xxx".rand(1,1000);
$value = str_repeat("x", rand(1, 1000));

if (!apc_store($key, $value)) {
    var_dump("write " . $i);
}

if ($value != ($new = apc_fetch($key))) {
    var_dump("read " . $i);
}
}
echo (microtime(true)-$start).'<br />';

apc_clear_cache();

$start = microtime(true);
for ($i = 0; $i<10000; $i++) {
$key = "xxx".rand(1,10000);
$value = str_repeat("x", rand(1, 1000));

if (!apc_store($key, $value)) {
    var_dump("write " . $i);
}

if ($value != ($new = apc_fetch($key))) {
    var_dump("read " . $i);
}
}
echo (microtime(true)-$start).'<br />';

Results:

0.038509845733643
0.039151906967163
0.041460990905762

0.037004947662354
0.038368940353394
0.040554046630859

0.037173986434937
0.038563966751099
0.040863037109375

It has no effect with yac.

from yac.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.