[erlang-questions] enif_make_reverse_list() vs lists:reverse()

Lukas Larsson <>
Fri May 4 20:14:49 CEST 2012


Hi,

The nif version is blocking while the bif isn't. So for long lists the nif will block the scheduler while the bif will not. If the blocking is acceptable or not is up to you. If unsure using lists:reverse is the safe choice.

Sent from me

On 4 maj 2012, at 19:26, Daniel Goertzen <> wrote:

> The documentation for enif_make_reverse_list() says ...
> 
> "This function should only be used on short lists as a copy will be
> created of the list which will not be released until after the nif
> returns."
> 
> I have a long-ish list.  Should I be opting to use lists:reverse()
> instead of enif_make_reverse_list()?  I assumed they were the same and
> for my situation I can use either, but the documentation suggests the
> nif version may be worse.
> 
> Dan.
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list