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 #1

Updated by François ARMAND over 13 years ago

  • Estimated time changed from 2.00 h to 1.00 h

Trait implementation:

trait HashcodeCaching { self: Product => override lazy val hashCode: Int = { println("hashCode " + this); scala.runtime.ScalaRunTime._hashCode(this) } }

Thus, I leave only one estimated hour left so we can add it on needing case classes

Actions #2

Updated by Jonathan CLARKE over 13 years ago

  • Category set to Architecture - Code maintenance
Actions #3

Updated by Jonathan CLARKE over 13 years ago

  • Target version changed from 10 to 13
Actions #4

Updated by Jonathan CLARKE over 13 years ago

  • Status changed from New to In progress

This issue is dedicated to the modification tracking about this. It will be updated to follow runs, and when done, just close it ;-)

Actions #5

Updated by Jonathan CLARKE over 13 years ago

  • Tracker changed from Architecture to User story
Actions #6

Updated by François ARMAND over 13 years ago

  • Target version changed from 13 to 14
  • % Done changed from 0 to 30

Done for inventory.

Actions #7

Updated by Jonathan CLARKE over 13 years ago

  • Target version changed from 14 to 15
Actions #8

Updated by Jonathan CLARKE over 13 years ago

  • Target version changed from 15 to 16
Actions #9

Updated by Jonathan CLARKE over 13 years ago

  • Target version changed from 16 to 19
Actions #10

Updated by Jonathan CLARKE about 13 years ago

  • Target version changed from 19 to 21
Actions #11

Updated by Jonathan CLARKE about 13 years ago

  • Target version changed from 21 to 23
Actions #12

Updated by Jonathan CLARKE about 13 years ago

  • Target version changed from 23 to 18
Actions #14

Updated by François ARMAND about 13 years ago

  • Target version changed from 18 to 2.4.0~alpha1
Actions #15

Updated by François ARMAND about 13 years ago

  • Status changed from In progress to Pending technical review
  • % Done changed from 30 to 100
Actions #16

Updated by Jonathan CLARKE almost 13 years ago

  • Assignee set to François ARMAND
Actions #17

Updated by Nicolas CHARLES almost 13 years ago

  • Status changed from Pending technical review to 10

This seems valid, i didn't find any case class left without the hashcode, but if any is found, we'll update this ticket

Actions #18

Updated by Jonathan CLARKE almost 13 years ago

  • Status changed from 10 to Released
Actions #19

Updated by Matthieu CERDA over 9 years ago

  • Subject changed from Cache des hashcode de case classes immutable to Immutable case class hashcode caching
  • Description updated (diff)
Actions

Also available in: Atom PDF