Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


a

This page is for Scala performance coding hints that should be used for performance critical code, such as the repetitive places in the Daffodil runtime module.

...

Then the prefix "J" on the name makes it clear that a boxed numeric type is being used.

Avoid Scala BigInt and BigDecimal Types

Scala's BigInt and BigDecimal types are both wrappers around Java's BigInteger and BigDecimal type. Since we do not need any of the additional functionality they provide, they just add another layer of indirection and object allocation. Instead, we should use Java's version of these data structures directly. To be consistent with our convention around numeric types, these Java types should be imported as below:

Code Block
import java.math.{BigInteger => JBigInt, BigDecimal => JBigDecimal}

Avoid Generic Collections of Unboxed Types

...