caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] boxing of floats in records/classes
@ 2002-09-25  2:30 Michael Vanier
  2002-09-26  8:01 ` Xavier Leroy
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Vanier @ 2002-09-25  2:30 UTC (permalink / raw)
  To: caml-list


Quick question: are mutable float fields in records or classes boxed?  If
so, why?

Mike
-------------------
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


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

* Re: [Caml-list] boxing of floats in records/classes
  2002-09-25  2:30 [Caml-list] boxing of floats in records/classes Michael Vanier
@ 2002-09-26  8:01 ` Xavier Leroy
  2002-09-26 11:14   ` Berke Durak
  0 siblings, 1 reply; 4+ messages in thread
From: Xavier Leroy @ 2002-09-26  8:01 UTC (permalink / raw)
  To: Michael Vanier; +Cc: caml-list

> Quick question: are mutable float fields in records or classes
boxed?

Yes, with the exception of records that have all fields of type float.
In the latter case, the record is represented like a float array, with
each float unboxed.

> If so, why?

Mainly because the runtime system and garbage collector support either
blocks of pointers or blocks of unboxed data, but not mixed blocks
containing both pointers and unboxed data.

- Xavier Leroy
-------------------
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


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

* Re: [Caml-list] boxing of floats in records/classes
  2002-09-26  8:01 ` Xavier Leroy
@ 2002-09-26 11:14   ` Berke Durak
  2002-09-27  9:04     ` Xavier Leroy
  0 siblings, 1 reply; 4+ messages in thread
From: Berke Durak @ 2002-09-26 11:14 UTC (permalink / raw)
  To: caml-list

On Thu, Sep 26, 2002 at 10:01:03AM +0200, Xavier Leroy wrote:
> > Quick question: are mutable float fields in records or classes
> boxed?
> 
> Yes, with the exception of records that have all fields of type float.
> In the latter case, the record is represented like a float array, with
> each float unboxed.
> 
> > If so, why?
> 
> Mainly because the runtime system and garbage collector support either
> blocks of pointers or blocks of unboxed data, but not mixed blocks
> containing both pointers and unboxed data.

Would it then be false to assume that if you have many floats in a record,
grouping them into a subrecord would reduce the boxing overhead ?
-- 
Berke Durak
-------------------
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


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

* Re: [Caml-list] boxing of floats in records/classes
  2002-09-26 11:14   ` Berke Durak
@ 2002-09-27  9:04     ` Xavier Leroy
  0 siblings, 0 replies; 4+ messages in thread
From: Xavier Leroy @ 2002-09-27  9:04 UTC (permalink / raw)
  To: Berke Durak; +Cc: caml-list

> Would it then be false to assume that if you have many floats in a record,
> grouping them into a subrecord would reduce the boxing overhead ?

This is true, even if you have as little as two float fields.
However, there would be some overhead when accessing one of these
fields, in the case where you need the field value to remain boxed
(i.e. to pass it to a Caml function).  Also, this appraoch sure would
not simplify the compiler :-)

- Xavier Leroy
-------------------
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


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

end of thread, other threads:[~2002-09-27  9:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-25  2:30 [Caml-list] boxing of floats in records/classes Michael Vanier
2002-09-26  8:01 ` Xavier Leroy
2002-09-26 11:14   ` Berke Durak
2002-09-27  9:04     ` Xavier Leroy

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