A reference type stores a reference to an object held separately from the reference itself. In F#, reference-type values are passed by reference, stored on the heap, and subject to garbage collection. section 5.2.2
Distinguish reference types from value types when choosing between ordinary and struct-based representations:
- Reference tuples are F#’s default tuple representation and incur garbage-collection costs. section 5.2.2
- Value tuples use the struct keyword, pass values by value, and generally avoid garbage collection by using stack storage. section 5.2.2
- F# records are reference types by default, but the [<Struct>] attribute changes a record into a value type. section 5.3.3
- Prefer the reference representation unless performance testing demonstrates that copying or garbage-collection costs justify the additional struct syntax. section 5.3.3 section 5.2.2
Changing a record’s representation
A normal record such as Address uses reference-type semantics. Adding [<Struct>] before the declaration makes it a value type instead; test the performance impact before making that change. section 5.3.3
[<Struct>]
type Address =
{
Line1 : string
...
}
Compare the ordinary record declaration with the [<Struct>] form to see the small syntax change that selects value-type semantics. section 5.3.3

