[erlang-questions] Retrieving "semi-constant" data from a function versus Mnesia

Benoit Chesneau <>
Sun May 17 11:28:24 CEST 2015


On Mon, May 11, 2015 at 2:32 PM Joe Armstrong <> wrote:

> On Sun, May 10, 2015 at 10:32 PM, Benoit Chesneau <>
> wrote:
> >
> >
> > On Sun, May 10, 2015 at 10:23 PM Joe Armstrong <> wrote:
> >>
> >> How large is the total data?
> >>
> >> If it's small you could define this in a module and not use a database
> >> or process at all.
> >
> >
> > How small should it be? What if the compiled bean is about 888 kilobytes?
>
> It depends :-)
>
> There are many factors involved:
>
>    a) How much memory do you have
>    b) How often do you want to change the configuration data
>    c) How quick do you the change to be
>
> Assume
>
>   a) is a smallish number of GBytes (normal these days)
>   b) is "relatively rarely" (I don't know what this means - (aside - this
> is why
>       I always ask people to provide numbers in their questions))
>      Say once a day
>   c) is a few seconds
>
> Then it should be perfectly doable. Making a module containing all the
> config data
> and recompiling when necessary is certainly the fastest way to access the
> data -
> this has very fast reads but very slow writes - you could think of a
> module as a database
> optimized for reads but not writes :-)
>
> /Joe
>
>
>
I see :) Thanks for the answer!

I'm already using such technic to speed access to unicode data in my IDNA
module [1] but always wondered if there is not a more efficient approach
since the compiled beam is quite big though less than 1MB. In term of speed
it's better that using ETS though I don't have the exact figures right now.

- benoit
[1]
https://github.com/benoitc/erlang-idna/blob/master/src/idna_unicode_data.erl




>
> >
> > - benoit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150517/a175eb77/attachment.html>


More information about the erlang-questions mailing list