Skip to content

Make fromList fuse #13

@treeowl

Description

@treeowl

OK, so this one is a little weird, but bear with me! If the argument of fromList is a good producer, then it is not an actual list in memory. So what? So if we take its length, that forces its realization as a list. If we don't take its length, then we have all sorts of other options, all of which are (typically) better. For example, we can build a list of SmallArrays holding chunks of, say, 32 elements each, and then concatenate them all in the end. That's inefficient, but less inefficient than what we do now.

For SmallArray, an option I thought about long ago is to use classic array doubling, and then shrink the final result. This will work just fine even if there is an actual list in memory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions