Skip to content

Why use data typed tuple compared to struct tuples? #559

Open
@minewarriorsSchool

Description

So I was reading through the code conventions of f# and came across the following paragraph:
https://learn.microsoft.com/en-us/dotnet/fsharp/style-guide/conventions#consider-struct-tuples-when-grouping-small-value-types-with-high-allocation-rates

Here they say that struct tuple can be up to 40% faster then data typed tuples.

Question: considering struct tuple can lead up to a 40% increase and do not allocate memory, what holds us back from defining commands as

type Msg =
| CommandX of struct(bool * int * string)

instead of

type Msg =
| CommandX of (bool * int * string)

The same goes for our model: https://learn.microsoft.com/en-us/dotnet/fsharp/style-guide/conventions#consider-struct-records-when-the-type-is-small-and-has-high-allocation-rates

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