caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Accessing record fields
@ 2013-09-15 10:30 José Romildo Malaquias
  2013-09-15 10:38 ` Jacques-Henri Jourdan
  2013-09-16  7:52 ` David MENTRE
  0 siblings, 2 replies; 4+ messages in thread
From: José Romildo Malaquias @ 2013-09-15 10:30 UTC (permalink / raw)
  To: caml-list

Hello.

OCaml offers at least two ways of accessing a record field: using the
dot notation, and doing pattern matching.

Does one of them deliver better performance than the other?

This may be relevant when a field is accessed multiple times.

For instance:

   type trec = { a : int; mutable b: int }

   let f {a;b} = a * a + b

   let g r = r.a * r.a + r.b

Which one would be preferred in this case: f or g?

Romildo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-16  7:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-15 10:30 [Caml-list] Accessing record fields José Romildo Malaquias
2013-09-15 10:38 ` Jacques-Henri Jourdan
2013-09-16  7:37   ` Goswin von Brederlow
2013-09-16  7:52 ` David MENTRE

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).