[squeak-smalltalk/squeak-object-memory] Avoid growth when filling large collections (Issue #160)
Marcel Taeumel via Squeak-dev <[email protected]> Wed, 17 Jun 2026 01:59:12 -0700
| Newsgroups | gmane.comp.lang.smalltalk.squeak.general |
|---|---|
| Message-ID | <squeak-smalltalk/squeak-object-memory/issues/[email protected]> |
marceltaeumel created an issue (squeak-smalltalk/squeak-object-memory#160) When filling large collections, we have `new:` to set the expected capacity and `new:withAll:` to also define the objects to put in. However, as we do not expose a collection's growth strategy, the use of `new:` gets tricky if one wants to avoid extra growth at all cost, e.g., when having millions of things. The growth strategy is hidden within a collection's implementation. A client would have to expose a best guess to avoid growth: ```Smalltalk bigDatabase := IdentityDictionary new: allObjects size * 4 // 3 + 16. ``` Here `numObjects * 4 // 3 + 16` is that guess. Maybe we want to offer a `newForSizeNoGrow:`. -- Reply to this email directly or view it on GitHub: https://github.com/squeak-smalltalk/squeak-object-memory/issues/160 You are receiving this because you are subscribed to this thread. Message ID: <squeak-smalltalk/squeak-object-memory/issues/[email protected]> Squeak-dev mailing list -- [email protected] To unsubscribe send an email to [email protected]