[Haskell-cafe] pure Haskell database

Graham Fawcett graham.fawcett at gmail.com
Thu Sep 25 16:11:33 EDT 2008


On Wed, Sep 24, 2008 at 5:17 PM, Manlio Perillo
<manlio_perillo at libero.it> wrote:
> Hi.
>
> I need a simple, concurrent safe, database, written in Haskell.
> A database with the interface of Data.Map would be great, since what I need
> to to is atomically increment some integer values, and I would like to avoid
> to use SQLite.

If that's the entire requirement, and you're looking for something
really fast, perhaps you could use a shared-memory region between the
processes (your keys would map to addresses in shared memory), and use
a compare-and-set algorithm to handle the atomic increments.

If you're on Intel/Itanium, I believe there's a CMPXCHG instruction
that will do atomic compare-and-set on a memory address, and I'm not
sure you could get much faster than that. :-)

Graham


More information about the Haskell-Cafe mailing list