Skip to content

Avoid growth when filling large collections #160

Description

@marceltaeumel

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:

bigDatabase := IdentityDictionary new: allObjects size * 4 // 3 + 16.

Here numObjects * 4 // 3 + 16 is that guess. Maybe we want to offer a newForSizeNoGrow:.

Metadata

Metadata

Assignees

No one assigned

    Labels

    base system[SCOPE] Squeak's basic (language) concerns such as Kernel, Collections, Graphics, Networkenhancement[WHAT] New feature, idea, conceptprogrammer[SCOPE] It is for the (maybe professional) programmer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions