Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] mutable Vs non mutable
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile STARYNKEVITCH <basile.starynkevitch@c...>
Subject: [Caml-list] mutable Vs non mutable
>>>>> "Animesh" == Animesh Pathak <animesh.pathak@inria.fr> writes:

    Animesh> What are the costs incurred (if any) in terms of program
    Animesh> size/speed if we use mutable variables in place of a non-
    Animesh> mutable one??

Only fields are mutable. When a mutable field is overwritten, the
garbage collector's write barrier is exercised.

This has some costs, first inside the write barrier's code, and
eventually inside the GC itself.

I've got no idea about the quantitative costs. But I am not worried of
using mutable fields (eg references) in my code when needed.  (I first
try to find the right algorithms. Optimization is usually useless....)

Regards

N.B. Any opinions expressed here are only mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.

---------------------------------------------------------------------
Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique * France
DRT/LIST/DTSI/SLA * CEA/Saclay b.528 (p111f) * 91191 GIF/YVETTE CEDEX 
phone:+33 1,6908.6055; fax: 1,6908.8395 home: 1,4665.4553; mobile: 6,8501.2359
work email: Basile point Starynkevitch at cea point fr 
home email: Basile at Starynkevitch point net

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners