From: Xavier Leroy <xavier.leroy@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Cross-platform DBM equivalent?
Date: Thu, 2 Jan 2003 11:03:26 +0100 [thread overview]
Message-ID: <20030102110326.J24166@pauillac.inria.fr> (raw)
In-Reply-To: <20021226071747.GC1071@swordfish>; from mgushee@havenrock.com on Thu, Dec 26, 2002 at 12:17:47AM -0700
> I am developing an application that needs fast access to persistent
> configuration data, and I thought that DBM might be a good way to
> provide that functionality ... but I see that DBM isn't available on
> Windows.
As others mentioned, you could compile the C sources for a DBM
implementation on Windows, then build the Caml/DBM binding.
> Is there something similar that works on all platforms? Or an
> alternative approach?
> By the way, I'm at an early prototyping stage, so I can't be much more
> specific about my needs. What I can say at this point is that speed is
> important; I think I need a key-value data structure, and it's probably
> okay for the types of both keys and values to be limited to strings, as
> with DBM.
I guess it all depends on the number of key-value pairs:
- For a few hundred entries, just parsing a plain text file is very
fast, e.g. using an ocamllex-generated lexer to do the parsing. Plain
text files also make debugging easier.
- Up to 10^5 entries, input_value of a hash table or a "map" is quite
fast, e.g. less than 0.1 seconds. This is what I use in the
SpamOracle mail filter to read the database of word frequencies.
It is true that the binary format used by input_value may change in
future OCaml releases, but so does the format of DBM databases, and
the input_value format hasn't changed in incompatible ways since 1996
or so :-) Still, it is prudent to support conversions between
input_value form and some textual, portable form.
- Beyond 10^5 entries, either DBM or a real database (such as MySQL)
seems best. Remember that DBM files are quite large, so an SQL
approach might be more effective.
Hope this helps,
- Xavier Leroy
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
prev parent reply other threads:[~2003-01-02 10:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-26 7:17 Matt Gushee
2002-12-26 8:39 ` Alessandro Baretta
2002-12-26 10:05 ` Matt Gushee
2002-12-26 16:50 ` Pierre Weis
2002-12-26 17:03 ` Joshua D. Guttman
2002-12-27 13:07 ` Pierre Weis
2002-12-26 17:08 ` David Brown
2002-12-26 18:23 ` Stefano Zacchiroli
2002-12-27 13:11 ` Pierre Weis
2003-01-12 10:13 ` Sven Luther
2002-12-26 19:20 ` Dmitry Bely
2002-12-27 13:19 ` Pierre Weis
2002-12-27 18:03 ` brogoff
2002-12-27 7:21 ` Matt Gushee
2002-12-26 20:00 ` Yaron M. Minsky
2003-01-02 10:03 ` Xavier Leroy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030102110326.J24166@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox