Performance considerations when using record types vs tuples
App Development2 posts234 views3 likesLast activity Jun 2022
MA
Matteo_LimbertoOP
Jun 2022Hi,
I was wondering if there are performance considerations to be aware of when choosing to use a record type (e.g. data R = R { a : Int, b : Text}) rather than a tuple (e.g. type T = (Int, Text)).
According to this doc page the two cases seem to be handled differently in LF.
Thank you,
Matteo
RE
Remy
Jun 2022From the point of view of the surface language, the tuples are primitive types. However, the compiler translates them to LF records. So there should not be any runtime performance difference between the two.
In general, it is a good practice to favor Record over Tuple in order to improve readability and type safety of your code.