Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* [Caml-list] caml match optimization
@ 2012-10-16 21:54 William
  2012-10-16 22:14 ` Gabriel Kerneis
  2012-10-16 22:17 ` Gabriel Scherer
  0 siblings, 2 replies; 3+ messages in thread
From: William @ 2012-10-16 21:54 UTC (permalink / raw)
  To: caml-list

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

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

end of thread, other threads:[~2012-10-16 22:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-16 21:54 [Caml-list] caml match optimization William
2012-10-16 22:14 ` Gabriel Kerneis
2012-10-16 22:17 ` Gabriel Scherer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox