在 Elixir 中,每个案例结构之间是否存在效率原因?

In Elixir, are there efficiency reasons between each case structure?

在 Elixir 中,使用 cond over case 是否有运行时或编译时效率方面的原因?案件结束 if/else;除非条件否定的 if 语句?

部分答案:

case/2cond/1都是编译器展开后委托给expand_case/3 and expand_cond/3的特殊形式,基本完全一样fold(reduce)[=14] =].

if/2 is a bare macro, which is expanded to case/2 在编译阶段。

也就是说,不,除了方便之外,没有显着差异。