Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
minewarriorsSchool opened this issue Apr 12, 2023 · 1 comment
Open

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

minewarriorsSchool opened this issue Apr 12, 2023 · 1 comment

Comments

@minewarriorsSchool
Copy link

minewarriorsSchool commented Apr 12, 2023

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

@TysonMN
Copy link
Member

TysonMN commented Apr 12, 2023

Nothing...I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants