Project

General

Profile

Bug #15797

Use `extends AnyVal` and remove HashCodeCaching for classes with one parameter

Added by François ARMAND about 2 months ago. Updated 16 days ago.

Status:
Released
Priority:
N/A
Category:
Performance and scalability
Target version:
Severity:
User visibility:
Effort required:
Priority:
0

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.


Subtasks

Bug #15966: Changing hashcode changes order in map, which breaks write testReleasedNicolas CHARLESActions

Related issues

Related to Rudder - Bug #15965: Trying to make LdapEntry immutable broke rudder - revertingPending releaseActions

Associated revisions

Revision 684a1cee (diff)
Added by François ARMAND about 1 month ago

Fixes #15797: Use `extends AnyVal` and remove HashCodeCaching for classes with one parameter

Revision de3e7bce
Added by François ARMAND about 1 month ago

Merge branch 'branches/rudder/5.0' into branches/rudder/6.0

Revision 9fe894c5 (diff)
Added by Vincent MEMBRÉ 29 days ago

Revert "Fixes #15797: Use `extends AnyVal` and remove HashCodeCaching for classes with one parameter"

This reverts commit 684a1ceeee3941c52e9c8797d2648d443a31f550.

Revision 84778f98
Added by Vincent MEMBRÉ 29 days ago

Merge branch 'branches/rudder/5.0' into branches/rudder/6.0

History

#1

Updated by François ARMAND about 2 months ago

  • Status changed from New to In progress
  • Assignee set to François ARMAND
#2

Updated by François ARMAND about 2 months 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)
#3

Updated by François ARMAND about 2 months ago

  • Category set to Performance and scalability
  • Target version set to 5.0.14
#5

Updated by François ARMAND about 2 months 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
#7

Updated by Vincent MEMBRÉ about 2 months ago

  • Target version changed from 5.0.14 to 5.0.15
#8

Updated by François ARMAND about 1 month ago

  • Status changed from Pending technical review to Pending release
#9

Updated by Vincent MEMBRÉ 29 days ago

  • Target version changed from 5.0.15 to 6.0.0~beta1
#10

Updated by Vincent MEMBRÉ 29 days 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 .

#11

Updated by Vincent MEMBRÉ 16 days ago

This bug has been fixed in Rudder 6.0.0~beta1 which was released today.

#12

Updated by Vincent MEMBRÉ 16 days ago

  • Related to Bug #15965: Trying to make LdapEntry immutable broke rudder - reverting added
#13

Updated by Vincent MEMBRÉ 16 days ago

  • Status changed from Pending release to Released

Also available in: Atom PDF