<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 12, 2015 at 3:49 PM, Alexander Petrovsky <span dir="ltr"><<a href="mailto:askjuise@gmail.com" target="_blank">askjuise@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">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).<br></div></blockquote><div><br></div><div>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:</div><div><br></div><div><a href="http://www.erlang.org/doc/man/erl_nif.html#enif_schedule_nif">http://www.erlang.org/doc/man/erl_nif.html#enif_schedule_nif</a></div><div><br></div><div>Here's an example from a presentation I've given covering schedulers and nifs:</div><div><br></div><div><a href="https://github.com/vinoski/bitwise/blob/master/c_src/bitwise_nif.c#L40-L110">https://github.com/vinoski/bitwise/blob/master/c_src/bitwise_nif.c#L40-L110</a><br></div><div><br></div><div>--steve</div></div></div></div>