<div dir="ltr">Hi!<br><div class="gmail_extra"><br><div class="gmail_quote">2015-04-12 22:18 GMT+04:00 ILYA Khlopotov <span dir="ltr"><<a href="mailto:ilya.khlopotov@gmail.com" target="_blank">ilya.khlopotov@gmail.com</a>></span>:<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"><div><div><div>I would suggest to try couple of things.<br><br></div>1. If N is always the same and as you've mentioned contains same keys and the total number of elements in proplists is less than <span>67108863 you can replace proplist with tuple. In this case you can use either foldl with getelement/</span><span><span>setelement</span></span><span>.<br></span></div></div></div></blockquote><div><br></div><div>Yes, it's less then 67198863. Do I understand correctly, you propose instead prolists like [{a,1}, {b,2} ...] use tuple like {a, 1, b, 2, ...} or just {1, 2, ...} ? Does it will be more efficient(getelement/setelement) then pattern matching in list comprehension over proplist?</div><div> </div><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"><div><div><span></span></div><span>2. review the requirements and consider incremental way of updating the counters on insertion.<br></span></div></div></blockquote><div><br></div><div>Yep, as I say in my first letter, I'm using incremental way right now via ets:update_counter, it takes about 1.5 secs when N=2. But it's still too slow. </div><div> </div><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"><div><span><br></span></div><div><span>BR,<br></span></div><div><span>ILYA<br></span></div><span><br></span><div><div><span><br><br></span></div></div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 12, 2015 at 10:53 AM, Grigory Fateyev <span dir="ltr"><<a href="mailto:gfborn@gmail.com" target="_blank">gfborn@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">Hello Alexander Petrovsky!<br>
<span>On Sun, 12 Apr 2015 21:23:09 +0400 you wrote:<br>
<br>
> Hello!<br>
><br>
> I have about 100 nodes in cluster, each node in cluster contains about<br>
> 100000 elements in proplist. All proplists have equal length, the same<br>
> keys, but different values. I need to get the sum values for every key<br>
> between all proplists. By example, it can be represented as matrix NxM<br>
> (N~=100, M~=100000), and I need to get the sum by column.<br>
><br>
> The problem is that it's too slow, even when I use the hackish way<br>
> with ets:update_counter and N=2, it's take about 1.5 secs, If I make<br>
> in parallel, it's take about 2-3 seconds.<br>
><br>
> How can I make it fast and efficient?<br>
><br>
<br>
</span>Look at lists:keyfind/4 It is much faster than proplists.<br>
<span><font color="#888888"><br>
--<br>
Best regards!<br>
gfborn [at] gmail [dot] com<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</font></span></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Петровский Александр / Alexander Petrovsky,<br><br>Skype: askjuise<br><div>Phone: +7 914 8 820 815<div><br></div></div></div></div>
</div></div>