[erlang-questions] Introspecting the atom table

Yariv Sadan yarivvv@REDACTED
Thu Dec 21 02:54:47 CET 2006


In ErlyWeb, I ran into a similar situation, where browser requests
would have to be matched against controller/function names. What I did
was create a gb_trees structure with string keys being the names of
the valid controllers and the values being the equivalent atom values
as well as lists of controller function names. Instead of converting
controller/function names of incoming requests to atoms, ErlyWeb looks
them up in the gb_trees structure for the application. This is how
ErlyWeb avoids allocating atoms for incoming requests.

I hope this approach has similar performance to checking the existence
of atoms. Does anybody think the latter is better?

Regards,
Yariv

On 12/20/06, Eric Merritt <cyberlync@REDACTED> wrote:
> I my case, its because I want to make it very easy to send 'matchable'
> messages into the system from the outside world. The fact that the
> atom table isn't garbage collected makes that somewhat dangerous. I
> can mitigate that danger by only converting strings to atoms for atoms
> that already exist.  There are dangers to even this approach. However,
> those dangers can be mitigated as well.
>
> On 12/20/06, Joel Reymont <joelr1@REDACTED> wrote:
> > Why would you want to check if an atom is in the atom table?
> >
> > I thought the atom table was a has table of sorts that did not house
> > duplicate atoms.
> >
> > Am I wrong or is it a huge time saver to check if the string is in
> > the atom table before attempting to create an atom?
> >
> >         Thanks, Joel
> >
> > On Dec 20, 2006, at 9:59 PM, Eric Merritt wrote:
> >
> > > Is there anyway to introspect the atom table? I would like to be able
> > > to take a string and check if that string has been interned in the
> > > atom table.
> >
> > --
> > http://wagerlabs.com/
> >
> >
> >
> >
> >
> >
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list