Hi all,

For my own curiosity regarding the overhead with memory-limit or keeping
track of usage so memory_get_[peak_]usage() can always be enabled, I just
did some quick testing.  Using this code

PHP_FUNCTION(emalloc_tester)
{
    int i;
    long mem_size;
    void *ptr;

    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &mem_size) ==
FAILURE) {
        return;
    }

    for (i = 0; i < 100000; i++) {
        ptr = emalloc(mem_size);
        efree(ptr);
    }
}

with different mem_size's and timing it.  Using the latest CVS files for
5.2; only difference is the --enable-memory-limit option.  Dual 930MHz PIII
Windows 2000 system (yes, *both* CPUs were maxed after mem_size got larger
than would fit into a block :-)).

          -ms-
Size   On     Off
------------------
8      10.6   10.8
32     10.7   10.8
128    10.6   10.8
512    16.2   16.5
1k     16.3   16.5
8k     16.3   16.6
64k    16.3   16.6
128k   16.3   16.6
256k   2155   2140
512k   2225   2210

Interesting that it was consistently faster for me *with* memory-limit at
the smaller sizes, which I assume are by far the most-used.  Does this help
at all? :-)


Matt

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to