Bug #15797
closedUse `extends AnyVal` and remove HashCodeCaching for classes with one parameter
Description
See https://docs.scala-lang.org/overviews/core/value-classes.html#summary_of_limitations
=> most of our IDs are suitable. May lead to far less pressure on GC.
Limitation are:
A value class … … must have only a primary constructor with exactly one public, val parameter whose type is not a user-defined value class. (From Scala 2.11.0, the parameter may be non-public.) … may not have specialized type parameters. … may not have nested or local classes, traits, or objects … may not define a equals or hashCode method. … must be a top-level class or a member of a statically accessible object … can only have defs as members. In particular, it cannot have lazy vals, vars, or vals as members. … cannot be extended by another class.
We also need to remove hashcodeCaching as the general feedback for it is that the JVM knows what it does on hashcode which is perhaps the most optimized code in it, and having a lazy val (or val) forced calculated at object creation has major perf impact.
Updated by François ARMAND about 5 years ago
- Status changed from New to In progress
- Assignee set to François ARMAND
Updated by François ARMAND about 5 years ago
- Subject changed from Use `extends AnyVal` for case classes with one parameter to Use `extends AnyVal` and remove HashCodeCaching for classes with one parameter
- Description updated (diff)
- Category deleted (
Performance and scalability) - Target version deleted (
5.0.14) - Name check deleted (
To do)
Updated by François ARMAND about 5 years ago
- Category set to Performance and scalability
- Target version set to 5.0.14
Updated by François ARMAND about 5 years ago
Work in progess here: https://github.com/fanf/rudder/commit/373b9ef282e34d04e7ae393b40dd7018bda38338
Updated by François ARMAND about 5 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from François ARMAND to Nicolas CHARLES
- Pull Request set to https://github.com/Normation/rudder/pull/2484
Updated by Vincent MEMBRÉ about 5 years ago
- Target version changed from 5.0.14 to 5.0.15
Updated by François ARMAND about 5 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset rudder|684a1ceeee3941c52e9c8797d2648d443a31f550.
Updated by Vincent MEMBRÉ about 5 years ago
- Target version changed from 5.0.15 to 6.0.0~beta1
Updated by Vincent MEMBRÉ about 5 years ago
This bug fix was moved to 6.0 and not to 5.0 because it breaks plugin api
rudder|684a1ceeee3941c52e9c8797d2648d443a31f550 was reverted by rudder|9fe894c5.
revert was not merged to 6.0 by merge in strategy ours rudder|de3e7bce.
code in 6.0 branch is a mix of rudder|684a1ceeee3941c52e9c8797d2648d443a31f550 and previous merge commit rudder|de3e7bce .
Updated by Vincent MEMBRÉ about 5 years ago
This bug has been fixed in Rudder 6.0.0~beta1 which was released today.
Updated by Vincent MEMBRÉ about 5 years ago
- Related to Bug #15965: Trying to make LdapEntry immutable broke rudder - reverting added
Updated by Vincent MEMBRÉ about 5 years ago
- Status changed from Pending release to Released