Project

General

Profile

Actions

User story #1285

closed

Immutable case class hashcode caching

Added by François ARMAND over 13 years ago. Updated over 9 years ago.

Status:
Released
Priority:
3
Category:
Architecture - Code maintenance
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:

Description

The default hashCode implementation for case classes is a method. We can cache the result for mutable cache classes, which would give noticeable perf improvements during operations on HashSet/HashMap.

Ex: override lazy val hashCode(): Int = ScalaRunTime.this._hashCode(Foo.this);

=> Can also be generalized with something like "CachedHashCode":

@see: http://www.scala-lang.org/node/7930

The time estimation for this and a first iteration on non mutable classes is 1 hour, the remaining should be done afterwards.

Actions

Also available in: Atom PDF