Some Scala code examples which are by no means exhaustive but just some things I wanted to write down.
Compiling a match expression to a tableswitch or lookupswitch is much more performant because it results in a branch table rather than a decision tree. Such as in the code:
The code with a value rather than an integer literal:
…could not be compiled to a tableswitch. However the code:
…yields a warning that a tableswitch is not being created.
Tail recursion vs imperative loop
Case class with trait-implemented function
Serialized Futures using flatMap
Serialized Futures using for comprehension
BLOCKING Futures using Awaits