PackageDescription: ICXVwHashTuning

ICX Vw Hash Tuning

Last published: January 18, 2012 by 'plbaumann'

Defines 0 Classes
Extends 3 Classes

Created by Paul Baumann on 2012.01.11 to demonstrate a performance opportunity.

CAUTION: This code contains an OPTIONAL feature can freeze your image
if not installed or uninstalled correctly.

The hashTuning_*install methods need to compile methods to get a
change to hashing in place without freezing the image. The
Set>>initialIndexFor:boundedBy: method will be different than
the Store definition. Do not load different version of this code directly
or else you will freeze the image. The method can only be installed
and uninstalled using the provided methods.

Modifications to VW hashed collections like Set (and subclasses) so that they are automatically
created to an efficient capacity for the size that the application code specifies. More details can
be found in the Set class>>capacityReport method.

(Set new: 1000) capacity
1750 "after change"
1009 "original VW"

(Set withAll: (Array new: 1000)) capacity
1750 "after change"
1511 "original VW"

(Set withAll: ((1 to: 1000) collect: [:i | Object new ])) capacity
1750 "after change"
1511 "original VW"

((Set new) addAll: ((1 to: 1000) collect: [:i | Object new ]); yourself) capacity
1536 "after change"
1361 "original VW"

((Set new: 1000) addAll: ((1 to: 1000) collect: [:i | Object new ]); yourself) capacity
1750 "after change"
2027 "original VW"

Tests similar to the last reduced execution time in half, finishes with less memory consumption, and ends with an efficient number of free slots available.