From: William <r.3@libertysurf.fr>
To: caml-list@inria.fr
Subject: [Caml-list] caml match optimization
Date: Tue, 16 Oct 2012 23:54:13 +0200 [thread overview]
Message-ID: <507DD785.8030300@libertysurf.fr> (raw)
Hello,
I have this code sample :
let apply_foo = apply_all_elements foo foo_struct
let apply_bar = apply_all_elements bar bar_struct
let apply_baz = apply_all_elements baz baz_struct
[...]
let apply_biz = apply_all_elements biz biz_struct
If I make a function such as :
let apply2 = function
| `Foo -> apply_all_elements foo foo_struct
| `Bar -> apply_all_elements bar bar_struct
| `Baz -> apply_all_elements baz baz_struct
[...]
| `Biz -> apply_all_elements biz biz_struct
How much is "apply2" inefficient ?
does caml tests for 20 elements if `Biz is number 21 ?
Or does ocaml try to convert the list of elements in a tree internally ?
(to optimise access) or something else ?
Regards,
William
next reply other threads:[~2012-10-16 21:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 21:54 William [this message]
2012-10-16 22:14 ` Gabriel Kerneis
2012-10-16 22:17 ` Gabriel Scherer
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=507DD785.8030300@libertysurf.fr \
--to=r.3@libertysurf.fr \
--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