# Localmemcache-0.4.2: Improves append performance

**URL:** <https://www.ruby-forum.com/t/localmemcache-0-4-2-improves-append-performance/173504>\
**Category:** Ruby\
**Created:** [August 10, 2009, 5:08pm UTC](https://www.ruby-forum.com/t/localmemcache-0-4-2-improves-append-performance/173504 "2009-08-10T17:08:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sven\_CSKoehler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3be4f8/32.png) [@Sven\_CSKoehler](https://www.ruby-forum.com/u/Sven_CSKoehler)\
**Post date:** [August 10, 2009, 5:08pm UTC](https://www.ruby-forum.com/t/localmemcache-0-4-2-improves-append-performance/173504/1 "2009-08-10T17:08:27Z")

</div>

I have noticed that Localmemcache can become extremely slow when  
keeping a hash that has growing values. It seems that the allocator  
ends up with a ever growing list of unusable free blocks. So version  
0.4.2 is the first attempt to make this a little more efficient, mostly  
by introducing the :min\_alloc\_size parameter.

Example pseudo append code:  
200\_000.times {  
index = rand(10000).to\_s  
v = $hash.get(r)  
$hash.set(r, “#{v}#{r}”)  
}

Localmemcache 0.4.1: 21961.375 ms  
Localmemcache 0.4.2: 19479.026 ms  
Localmemcache 0.4.2 + :min\_alloc\_size =\> 1024: 863.839 ms  
Ruby Hash of Strings: 790.34 ms

Link to :min\_alloc\_size documentation:  
[http://localmemcache.rubyforge.org/doc/classes/LocalMemCache.html#M000001](http://localmemcache.rubyforge.org/doc/classes/LocalMemCache.html#M000001)

# INSTALL

# gem install localmemcache

# CONTACT

Please contact me with bugs, suggestions and patches at: schween + snafu

# de

# LINKS

Localmemcache: [http://localmemcache.rubyforge.org/](http://localmemcache.rubyforge.org/)  
Rubyforge project: [http://localmemcache.rubyforge.org/](http://localmemcache.rubyforge.org/)

Source code is hosted on github: [GitHub - sck/localmemcache: mmap -\> lmc\_valloc -\> hashtable. BAM database](http://github.com/sck/localmemcache/)

Best,

Sven

dd799ce53c5f56a02823a0ad816fd18c localmemcache-0.4.2.gem  
a006379e0be24eb2cf5ed60e163af4a2 localmemcache-0.4.2.tar.gz
