[erlang-questions] 回复： which one is more efficiency? ets or pattern match?
Jesper Louis Andersen
Wed Mar 16 13:32:54 CET 2016
It is pretty good for lookup tables. Another such implementation:
On Wed, Mar 16, 2016 at 1:16 PM, Dan Gudmundsson <dangud@REDACTED> wrote:
> You can build large tuples and use element/2 on them as well, for example
> see functions in the bottom of rand.erl.
> On Wed, Mar 16, 2016 at 12:58 PM Vance Shipley <vances@REDACTED> wrote:
>> On Wed, Mar 16, 2016 at 5:07 PM, 饕餮 <249505968@REDACTED> wrote:
>> > But someone is afraid about the efficiency of pattern match.(because we
>> > not very sure about the efficiency of pattern match,just heard that if
>> > code is good, it will be a binary search).
>> Pattern matching is quite efficient up to some point of design intent.
>> Some guidance is in the Efficiency Guide here:
>> What you need to worry about however is in how many clauses heads you
>> have. I once benchmarked this and found that it worked well up to
>> something on the order of thousands but wouldn't compile beyond that.
>> This is the sort of thing which could change for the better or worse
>> with any Erlang release because they've never expressed a guarantee.
>> I haven't tried it lately.
>> erlang-questions mailing list
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions