From: Philippe Wang <lists@philippewang.info>
To: caml-list@inria.fr
Subject: Re: [Caml-list] A Question About Types and Inlining
Date: Sat, 09 Dec 2006 02:16:16 +0100 [thread overview]
Message-ID: <457A0E60.6080204@philippewang.info> (raw)
In-Reply-To: <20061209005506.GD3642@localhost>
Eric Cooper a écrit :
> You can use
> type variable = Variable of int
> etc.
> in your signatures.
>
> This makes the representation visible for optimization purposes,
> incurs no representation overhead, but will catch most typing
> mistakes.
I don't get it... Can you tell how adding some boxing/unboxing matter
can help having better performance ?
I tried this with ocamlopt -inline 4
type v = V of int
let v = V 42 ;;
let _ = match v with V x -> print_int x ;;
print_newline();;
let _ = print_int (Obj.magic v);;
print_newline();;
let _ = print_int (!(Obj.magic v));;
print_newline();;
So whether the Obj.magic "tells" the compiler not to optimise the values
of type v, whether I really don't get what you meant...
Cheers,
--
Philippe Wang
next prev parent reply other threads:[~2006-12-09 1:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-08 23:13 Jim Grundy
[not found] ` <4579F655.3030307@philippewang.info>
[not found] ` <4579F8E1.6070604@ichips.intel.com>
2006-12-09 0:07 ` [Caml-list] " Philippe Wang
2006-12-09 0:55 ` Eric Cooper
2006-12-09 1:16 ` Philippe Wang [this message]
2006-12-09 1:31 ` Eric Cooper
2006-12-09 9:28 ` Jon Harrop
2006-12-09 11:28 ` Andrej Bauer
2006-12-09 13:12 ` Nicolas Pouillard
2006-12-10 6:27 ` Christian Stork
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=457A0E60.6080204@philippewang.info \
--to=lists@philippewang.info \
--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