Performance characteristics
In Scala, different collections have different characteristics and these performance characteristics are the reason you will prefer to choose one collection over the others. In this section, we will judge the performance characteristics of Scala collection objects from the operational and memory usage point of view. At the end of this section, we will provide some guidelines for selecting appropriate collection objects for your code and problem types.
Performance characteristics of collection objects
The following are the characteristics Scala Collections, based on the official documentation of Scala.
- Const: The operation takes only constant time.
- eConst: The operation takes effectively constant time, but this might depend on some assumptions such as the maximum length of a vector or the distribution of hash keys.
- Linear: The operation grows linearly with the collection size.
- Log: The operation grows logarithmically with the collection size.
- aConst: The operation takes...