[erlang-questions] 回复: which one is more efficiency? ets or pattern match?
Dan Gudmundsson
dangud@REDACTED
Wed Mar 16 13:16:34 CET 2016
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
> are
> > not very sure about the efficiency of pattern match,just heard that if
> the
> > 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:
> http://erlang.org/doc/efficiency_guide/functions.html#id68205
>
> 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.
>
>
>
> --
> -Vance
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160316/6207e351/attachment.htm>
More information about the erlang-questions
mailing list