Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
mutable record fields and performance
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-10-24 (20:13)
From: Florian Weimer <fw@d...>
Subject: Re: [Caml-list] mutable record fields and performance
* 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).