From: "José Romildo Malaquias" <j.romildo@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Accessing record fields
Date: Sun, 15 Sep 2013 07:30:27 -0300 [thread overview]
Message-ID: <20130915103027.GA21344@jrm> (raw)
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
next reply other threads:[~2013-09-15 10:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-15 10:30 José Romildo Malaquias [this message]
2013-09-15 10:38 ` Jacques-Henri Jourdan
2013-09-16 7:37 ` Goswin von Brederlow
2013-09-16 7:52 ` David MENTRE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130915103027.GA21344@jrm \
--to=j.romildo@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox