[erlang-questions] Efficient sum matrix by column

Steve Vinoski <>
Sun Apr 12 22:48:15 CEST 2015


On Sun, Apr 12, 2015 at 3:49 PM, Alexander Petrovsky <>
wrote:

> The proplists already sorted. Thanks, I will look at N-ary tree. Looks
> like the NIF it's not a good idea due the sum of two lists with 100000 each
> will be more then 1ms (btw I know about dirty schedulers).
>

You don't need dirty schedulers in this case. Have a look at
enif_schedule_nif, which would allow you to break the computation into
chunks that don't violate scheduler time constraints:

http://www.erlang.org/doc/man/erl_nif.html#enif_schedule_nif

Here's an example from a presentation I've given covering schedulers and
nifs:

https://github.com/vinoski/bitwise/blob/master/c_src/bitwise_nif.c#L40-L110

--steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150412/32644aa4/attachment.html>


More information about the erlang-questions mailing list