Is using PartialFunction
orElse
more or less efficient than using a large match
block for apply
time?
To illustrate the question, follow these steps:
val pf = { case "a" => "A"} orElse { case "b" => "B" } orElse { case "c" => "C" } ...
more or less effective than:
val pf = { case "a" => "A" case "b" => "B" case "c" => "C" ... }
during application pf
value:
pf(x)
source share