From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 3D66A8021B for ; Tue, 19 Sep 2017 15:24:22 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jesper.louis.andersen@gmail.com; spf=Pass smtp.mailfrom=jesper.louis.andersen@gmail.com; spf=None smtp.helo=postmaster@mail-io0-f182.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jesper.louis.andersen@gmail.com) identity=pra; client-ip=209.85.223.182; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jesper.louis.andersen@gmail.com"; x-sender="jesper.louis.andersen@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jesper.louis.andersen@gmail.com designates 209.85.223.182 as permitted sender) identity=mailfrom; client-ip=209.85.223.182; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jesper.louis.andersen@gmail.com"; x-sender="jesper.louis.andersen@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-io0-f182.google.com) identity=helo; client-ip=209.85.223.182; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jesper.louis.andersen@gmail.com"; x-sender="postmaster@mail-io0-f182.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3Ar2ey/BU/2lmhWE42B9jCc4hqV7/V8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYZhOHt8tkgFKBZ4jH8fUM07OQ6P+wHzFYqb+681k8M7V0Hycfjs?= =?us-ascii?q?sXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aMlzFOAF0?= =?us-ascii?q?PuX4HJLJx4Tyjrjqus7lWBhTnDe2fZ91KRy3q02R6phX0sNeLfMRxx/Mv2cAUf?= =?us-ascii?q?5fw29sbQaTkhL5+9v29oRq9ShUk/0k54hGXLmsO+wzRLlcRCk9PnourJngvBzH?= =?us-ascii?q?CA+O/Wc0U2MMkxMODRKTvz/gWZKkkCbhrudnkA2dIMztBZkyVTm49KptAEvqhT?= =?us-ascii?q?wfOiR/9GbKi9c2haRXrQi6qhpXzIvdYYXTP/17KPCONegGTHZMC54CHxdKBZmx?= =?us-ascii?q?Os5SVuc=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AgCwCXGcFZhrbfVdFcHAEBBAEBCgEBF?= =?us-ascii?q?QEBAQECAQEBAQgBAQEBhBNuJ4N1gTaPEolPgXSCSZNbghIKJYUWAoRYQRYBAQE?= =?us-ascii?q?BAQEBAQEBARIBAQEICwsIKC+CMwUBHgaCOwEBAQECASMdARsSDAMBCwYFCw0NH?= =?us-ascii?q?QICIQEBEQEFAQoSBgESEooIAQMNCBCeBECMC4IFBQEcgwoFg18KGScDCleDCAE?= =?us-ascii?q?BAQEGAQEBAQEBARkCBhKDGYIChluCWIJNgmaCYAWIJgyYHjyHXINchCeEd4Juk?= =?us-ascii?q?AyMXIhHFCSBFQ8XCoE0MiEkXhqEcB+Bc0A2hxqBUwEBAQ?= X-IPAS-Result: =?us-ascii?q?A0AgCwCXGcFZhrbfVdFcHAEBBAEBCgEBFQEBAQECAQEBAQg?= =?us-ascii?q?BAQEBhBNuJ4N1gTaPEolPgXSCSZNbghIKJYUWAoRYQRYBAQEBAQEBAQEBARIBA?= =?us-ascii?q?QEICwsIKC+CMwUBHgaCOwEBAQECASMdARsSDAMBCwYFCw0NHQICIQEBEQEFAQo?= =?us-ascii?q?SBgESEooIAQMNCBCeBECMC4IFBQEcgwoFg18KGScDCleDCAEBAQEGAQEBAQEBA?= =?us-ascii?q?RkCBhKDGYIChluCWIJNgmaCYAWIJgyYHjyHXINchCeEd4JukAyMXIhHFCSBFQ8?= =?us-ascii?q?XCoE0MiEkXhqEcB+Bc0A2hxqBUwEBAQ?= X-IronPort-AV: E=Sophos;i="5.42,418,1500933600"; d="scan'208,217";a="238015148" Received: from mail-io0-f182.google.com ([209.85.223.182]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 19 Sep 2017 15:24:20 +0200 Received: by mail-io0-f182.google.com with SMTP id m103so9848710iod.13 for ; Tue, 19 Sep 2017 06:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=6j9cM2giEyB73BLS0QbfBorcWECLiSPqP6zsl9Eq1hg=; b=ZtCGI6A9o9XwlAggqeqJZ+HU58+fS0KPRZ0+xWGmq6EY9y6yq0xMk1OGr+eZG3scAy qsly7Kj6qcwPbcXgbivRfigTEpDb2HBvDuN37nh/W7fv58OkGmswylT8NTnSG0pzOyVE rC/DL4RKPcnJ1hKxCPIqWXAdK3EWOCj2/wsCQ/2rxeEMnAdFdMra9PGO8PrhmhiHdwsh dYvlwtLOjVfWCdheBi/8x/SfJUfT3CuAtoko7Cis2FI/+bTpw1vh2eTe28NRdk1u/Z9l 4i9eF59r9guDDckfFX0KlPGKYg7gcYnm9iPNEAmucA9JN2mPFJQ2YkOoFZgrh8/aaykq mnWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=6j9cM2giEyB73BLS0QbfBorcWECLiSPqP6zsl9Eq1hg=; b=NUcFyhYwvNRZRtkpsz+H9fbKEZH9gmnkmwu4V0oZgp+6deBBdJ6puMi3ayglhl1Z6M yhyz8X98YsQUGZsTSEbb7u5ZObFlig48OWPPTQQ0P8MxIe4KZ+UEWQOkciC9bD6vkWcp tU6QjQ9q5/TyHFVecd/a8iwAVK0gn6OYcX85PHHz6aBROS1i2lgKYg7vQJZ0UsyC2AUr 5fOf963+c35r9bqudwTnAzyo5zkyPCwewKkVatfR+SXkZI4Gjs1aqwdGOT1E5p9+V9xz CKChmG0pitzzkl5T8YG2p3ytcA7W3yYURlm7gmejQlpm/H8jbQU8hHqVMeOHnjyM5ZF5 M27Q== X-Gm-Message-State: AHPjjUiHO3BRt+MGFM04RZz1wHEujpShtMWdv1DsI+X7Zchoc6MHXXEY oB/bBNOZrss6CgrBIwb9GMNipbvRUH2FTgxvuw== X-Google-Smtp-Source: AOwi7QB7N9W8/zXuN2fNkRD4jH4KhcGQHz/dAr9GWA1ZkXswwlR/skYLSuhbG69TVZ2Xa44GDExUx5sjPKPEiHjYUGY= X-Received: by 10.202.231.141 with SMTP id e135mr1457456oih.265.1505827459286; Tue, 19 Sep 2017 06:24:19 -0700 (PDT) MIME-Version: 1.0 References: <41FF6520-51D5-4EB7-A8AF-6BB9C495D1E8@gmx.net> <690A132C-892E-45DC-A884-415E92054AC4@gmx.net> In-Reply-To: <690A132C-892E-45DC-A884-415E92054AC4@gmx.net> From: Jesper Louis Andersen Date: Tue, 19 Sep 2017 13:24:08 +0000 Message-ID: To: Helmut Brandl , caml users Content-Type: multipart/alternative; boundary="001a114095f8cdcd5805598ac6da" Subject: Re: [Caml-list] Performance penalty for using monad --001a114095f8cdcd5805598ac6da Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It was some time ago, but I was toying with an encoder/decoder for the "Transit" format (of Clojure/Cognitect fame). That decoder used monads heavily as well, and flambda provided roughly an order of magnitude speedup (and a lower GC pressure as well in addition). It was enough that I made a mental note of using flambda if this ever went into a system with high throughput requirements. On Tue, Sep 19, 2017 at 2:47 PM Helmut Brandl wrote: > Thanks for the hint > > Helmut > > On Sep 18, 2017, at 10:31, Yotam Barnoy wrote: > > > > You might find this > > ( > https://discuss.ocaml.org/t/ann-monads-the-missing-monad-transformers-lib= rary/830/8 > ) > > discussion relevant. > > > > On Mon, Sep 18, 2017 at 11:23 AM, Helmut Brandl > wrote: > >> I want to restructure my project using monads (reader, state, option, > etc.) in order to get cleaner code. > >> > >> Is there any performance penalty to pay. From my understanding there > shouldn=E2=80=99t be any or only very little since aggressive inlining sh= ould be > able to compile the monads away. > >> > >> Is there any experience on how the optimizing ocaml compiler is able to > optimize monadic code? > >> > >> Regards > >> Helmut > >> > >> -- > >> Caml-list mailing list. Subscription management and archives: > >> https://sympa.inria.fr/sympa/arc/caml-list > >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > >> Bug reports: http://caml.inria.fr/bin/caml-bugs > > > > -- > > Caml-list mailing list. Subscription management and archives: > > https://sympa.inria.fr/sympa/arc/caml-list > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs --001a114095f8cdcd5805598ac6da Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
It was some time ago, but I was toying with an encoder/dec= oder for the "Transit" format (of Clojure/Cognitect fame). That d= ecoder used monads heavily as well, and flambda provided roughly an order o= f magnitude speedup (and a lower GC pressure as well in addition). It was e= nough that I made a mental note of using flambda if this ever went into a s= ystem with high throughput requirements.

On Tue, Sep 19, 2017 at 2:47 PM Helmut Brandl <helmut.brandl@gmx.net> wrote:=
Thanks for the hint

Helmut
> On Sep 18, 2017, at 10:31, Yotam Barnoy <yotambarnoy@gmail.com> wrote:
>
> You might find this
> (https://dis= cuss.ocaml.org/t/ann-monads-the-missing-monad-transformers-library/830/8)
> discussion relevant.
>
> On Mon, Sep 18, 2017 at 11:23 AM, Helmut Brandl <
helmut.brandl@gmx.net> wrot= e:
>> I want to restructure my project using monads (reader, state, opti= on, etc.) in order to get cleaner code.
>>
>> Is there any performance penalty to pay. From my understanding the= re shouldn=E2=80=99t be any or only very little since aggressive inlining s= hould be able to compile the monads away.
>>
>> Is there any experience on how the optimizing ocaml compiler is ab= le to optimize monadic code?
>>
>> Regards
>> Helmut
>>
>> --
>> Caml-list mailing list.=C2=A0 Subscription management and archives= :
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/g= roup/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
> --
> Caml-list mailing list.=C2=A0 Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group= /ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocam= l_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
--001a114095f8cdcd5805598ac6da--