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

Daniel Goertzen daniel.goertzen@REDACTED
Sat May 5 22:58:27 CEST 2012


Good reason to keep the reverse in Erlang then.

Thanks,
Dan.

On Fri, May 4, 2012 at 1:14 PM, Lukas Larsson <garazdawi@REDACTED> wrote:
> 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 <daniel.goertzen@REDACTED> 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
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list