Hashed collections keep a portion of the available memory empty (usually 25%) as a partition mechanism to increase lookup speed. "Normal array" | col | col := Smalltalk allClassesAndTraits asArray. [ col includes: 8; includes: Morph ] bench. "'366.853 per second'" "Normal set ~75% load" | set | set := Smalltalk allClassesAndTraits asSet. [ set includes: 8; includes: Morph ] bench. "'4,700,967 per second'" "Set forced to have ~100% load" | array fullLoadSet | array := Smalltalk allClassesAndTraits asSet asArray , #(nil). fullLoadSet:= Set basicNew. fullLoadSet instVarNamed: #array put: array; instVarNamed: #tally put: array size. [ fullLoadSet includes: 8; includes: Morph ] bench. "'215.157 per second'" Best regards, Henrik From: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] On Behalf Of Christophe Demarey Sent: Thursday, December 1, 2016 11:49 AM To: Pharo Development List <pharo-dev@lists.pharo.org> Subject: [Pharo-dev] Set internal array size Hi, I just discovered a funny thing. If you create a Set with Set new, you will get a Set with an internal array of 5 elements (hardcoded in Set class>>#new). If you ask explicitly a Set for one or no element: Set new: 0 (or a number between 0 and 5), you will get an internal array of 7 elements. This behavior is a bit strange. Either we always need at least 7 elements and we need to update Set class>>#new, either the method Set class>>#sizeFor: should be updated. WDYT? Christophe