caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* mutable record fields and performance
@ 2006-10-21  3:41 j.romildo
  2006-10-24 20:12 ` [Caml-list] " Florian Weimer
  0 siblings, 1 reply; 2+ messages in thread
From: j.romildo @ 2006-10-21  3:41 UTC (permalink / raw)
  To: caml-list

Hello.

How do the implementation of mutable and imuttable record fields differ
in ocaml? Have them any impact on field access performance?

That is, the expression p.x has different performances for the types
{ x:int } and { mutable x:int } for p?

In summary, what additional cost does the use of mutable imposes on a
record field?

Romildo


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

* Re: [Caml-list] mutable record fields and performance
  2006-10-21  3:41 mutable record fields and performance j.romildo
@ 2006-10-24 20:12 ` Florian Weimer
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Weimer @ 2006-10-24 20:12 UTC (permalink / raw)
  To: caml-list

* j. romildo:

> That is, the expression p.x has different performances for the types
> { x:int } and { mutable x:int } for p?
>
> In summary, what additional cost does the use of mutable imposes on a
> record field?

Internally, record fields are always mutable.  Adding a mutable
declaration should not incur a performance cost.  perhaps with the
exception that the compiler will see less opportunities for
elimination of common subexpression (but I'm not sure if it performs
this optimization at all).


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

end of thread, other threads:[~2006-10-24 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-21  3:41 mutable record fields and performance j.romildo
2006-10-24 20:12 ` [Caml-list] " Florian Weimer

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).