Am 19.12.2006 um 20:42 schrieb Stephen Deasey:
On 12/19/06, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
Right, with Ns_ functions it does not crash.
Zoran will be happy... :-)
In fact, yes! I'm more than happy to announce something
that will change the way we use computers in 22 century
(if we live enough to witness it) :-)
Seriously...
I've been on a search for an allocator that will be fast
enough and not so memory hungry as the allocator being
built in Tcl. Unfortunately, as it mostly is, it turned
out that I had to write my own.
Vlad has written an allocator that uses mmap to obtain
memory for the system and munmap that memory on thread
exit, if possible.
I have spent more than 3 weeks fiddling with that and
discussing it with Vlad and this is what we bith come to:
http://www.archiware.com/downloads/vtmalloc-0.0.1.tar.gz
I believe we have solved most of my needs. Below is an excerpt
from the README file for the qurious.
If anybody would care to test it in his/her own environment?
If all goes well, I might TIP this to be included in Tcl core
as replacement of (or addition to) the zippy allocator.
-------------------------------------------------
Compared was performace of OS memory allocator (Standard),
Tcl built-in threading allocator (Zippy) and this (VT) allocator.
First table shows testing alloc/free operations on 16000 blocks of
memory
each of random size, between 16 and 16384 bytes. The total number of
blocks is divided among threads, so 1 thread operates on 16000 blocks,
2 threads each on 8000, 4 threads each at 4000 blocks etc.
For each test, program was run three times and the best value was taken.
Speed numbers are in operations/second. More is better.
Second table showns memory usage. Values are gathered by peeking
at the system "top" utility.
The "Top" is peak memory during program run.
The "Low" is just before the program exits.
Memory usage numbers are (rounded) in MB. Less is better.
Machine: Apple Mac Pro, 2 x Intel Core Duo 2.66GHz, 1GB, Mac OSX 10.4.8
========================================================================
| Allocator| 1 threads | 2 threads | 4 threads | 8 threads |16 threads |
+==========+===========+===========+===========+===========+===========+
| Standard | 2.316.454 | 2.187.852 | 2.103.777 | 2.108.825 | 2.304.939 |
+----------+-----------+-----------+-----------+-----------+-----------+
| Zippy | 7.111.380 | 3.214.132 | 1.450.300 | 851.347 | 870.573 |
+----------+-----------+-----------+-----------+-----------+-----------+
| VT |25.047.968 |25.438.877 |30.615.718 |48.845.898 |70.713.324 |
========================================================================
=================================================================
| | Top | Low |
| Allocator | Resident | Virtual | Resident | Virtual |
+-----------+------------+------------+------------+------------+
| Standard | 49 | 125 | 49 | 112 |
+-----------+------------+------------+------------+------------+
| Zippy | 102 | 182 | 102 | 182 |
+-----------+------------+------------+------------+------------+
| VT | 43 | 169 | 1 | 50 |
=================================================================
Machine: Sun Ultra 20, 1 x AMD 2.6GHz, 2GB, Solaris 10
========================================================================
| Allocator| 1 threads | 2 threads | 4 threads | 8 threads |16 threads |
+==========+===========+===========+===========+===========+===========+
| Standard | 7.725.757 | 7.940.706 | 8.661.384 | 9.673.767 |11.348.060 |
+----------+-----------+-----------+-----------+-----------+-----------+
| Zippy | 9.375.668 | 9.638.397 |10.044.609 |10.121.013 |10.126.495 |
+----------+-----------+-----------+-----------+-----------+-----------+
| VT |13.539.585 |14.018.716 |14.058.184 |14.287.382 |15.206.398 |
========================================================================
=================================================================
| | Top | Low |
| Allocator | Resident | Virtual | Resident | Virtual |
+-----------+------------+------------+------------+------------+
| Standard | 67 | 97 | 67 | 97 |
+-----------+------------+------------+------------+------------+
| Zippy | 128 | 153 | 128 | 153 |
+-----------+------------+------------+------------+------------+
| VT | 44 | 137 | 2 | 19 |
=================================================================
Machine: AMD Athlon XP2200, 1.8GHz, 512MB, Linux Suse9.1
========================================================================
| Allocator| 1 threads | 2 threads | 4 threads | 8 threads |16 threads |
+==========+===========+===========+===========+===========+===========+
| Standard | 4.200.372 | 3.858.008 | 3.690.765 | 3.631.439 | 3.619.962 |
+----------+-----------+-----------+-----------+-----------+-----------+
| Zippy | 6.431.475 | 6.379.019 | 6.717.106 | 7.623.886 | 8.332.113 |
+----------+-----------+-----------+-----------+-----------+-----------+
| VT | 9.012.948 | 8.927.450 | 9.021.192 | 9.339.430 | 9.687.016 |
========================================================================
=================================================================
| | Top | Low |
| Allocator | Resident | Virtual | Resident | Virtual |
+-----------+------------+------------+------------+------------+
| Standard | 41 | 101 | 2 | 16 |
+-----------+------------+------------+------------+------------+
| Zippy | 114 | 154 | 114 | 154 |
+-----------+------------+------------+------------+------------+
| VT | 35 | 147 | 1 | 23 |
=================================================================
Any questions or suggestions are welcome.
Enjoy!