pavelpavlov/scala — comment on commit bdf2c627aba4d3e8b5105df9ac1e3f02078bc6fc
File:  line 0
By odersky:

Yes, I think this can work. Thank you for this contribution, Pavlov! I still would be interested in a performance comparison of your solution and mine. At first glance, it looks like the change to the types can be made independently of whether one uses a mutable fallback (as in my solution) or a forwarder (as in yours). My solution has the cost of a synchronized in the construction of the partial function, but the apply is optimal in the sense that it there is no overhead if the original partial function is invoked (as opposed to the orElse argument). Your solution makes the apply go through one forwarder per orElse. Not sure what difference this will make.