From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 5F38E7EC41 for ; Tue, 16 Oct 2012 23:54:15 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of r.3@libertysurf.fr) identity=pra; client-ip=93.17.128.2; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="r.3@libertysurf.fr"; x-sender="r.3@libertysurf.fr"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of r.3@libertysurf.fr) identity=mailfrom; client-ip=93.17.128.2; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="r.3@libertysurf.fr"; x-sender="r.3@libertysurf.fr"; x-conformance=sidf_compatible Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp21.services.sfr.fr) identity=helo; client-ip=93.17.128.2; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="r.3@libertysurf.fr"; x-sender="postmaster@smtp21.services.sfr.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkwBALTWfVBdEYACjmdsb2JhbABFwBUjAQEBAQcNCQkSBSSCThFAPRYYAwIBAgE/GQgBAYgEmVeRB5BAjm6DIQOOAY1MjT8 X-IronPort-AV: E=Sophos;i="4.80,595,1344204000"; d="scan'208";a="159271330" Received: from smtp21.services.sfr.fr ([93.17.128.2]) by mail4-smtp-sop.national.inria.fr with ESMTP; 16 Oct 2012 23:54:14 +0200 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2106.sfr.fr (SMTP Server) with ESMTP id 4D5037000060 for ; Tue, 16 Oct 2012 23:54:14 +0200 (CEST) Received: from [192.168.1.2] (49.130.7.93.rev.sfr.net [93.7.130.49]) by msfrf2106.sfr.fr (SMTP Server) with ESMTP id 211D87000053 for ; Tue, 16 Oct 2012 23:54:14 +0200 (CEST) X-SFR-UUID: 20121016215414135.211D87000053@msfrf2106.sfr.fr Message-ID: <507DD785.8030300@libertysurf.fr> Date: Tue, 16 Oct 2012 23:54:13 +0200 From: William User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120912 Thunderbird/15.0.1 MIME-Version: 1.0 To: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Caml-list] caml match optimization 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