From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr 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 BEB3F80198 for ; Tue, 11 Jul 2017 19:46:35 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=yotambarnoy@gmail.com; spf=Pass smtp.mailfrom=yotambarnoy@gmail.com; spf=None smtp.helo=postmaster@mail-yb0-f171.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of yotambarnoy@gmail.com) identity=pra; client-ip=209.85.213.171; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="yotambarnoy@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of yotambarnoy@gmail.com designates 209.85.213.171 as permitted sender) identity=mailfrom; client-ip=209.85.213.171; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="yotambarnoy@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-yb0-f171.google.com) identity=helo; client-ip=209.85.213.171; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="postmaster@mail-yb0-f171.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AOxzSCRReDoQ/ZFgWInR5+UkLx9psv+yvbD5Q0YIu?= =?us-ascii?q?jvd0So/mwa6yZhKN2/xhgRfzUJnB7Loc0qyN4v+mATRIyK3CmUhKSIZLWR4BhJ?= =?us-ascii?q?detC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TW94jEIBxrwKxd+?= =?us-ascii?q?KPjrFY7OlcS30P2594HObwlSijewZbF/IA+qoQnNq8IbnZZsJqEtxxXTv3BGYf?= =?us-ascii?q?5WxWRmJVKSmxbz+MK994N9/ipTpvws6ddOXb31cKokQ7NYCi8mM30u683wqRbD?= =?us-ascii?q?VwqP6WACXWgQjxFFHhLK7BD+Xpf2ryv6qu9w0zSUMMHqUbw5Xymp4rx1QxH0li?= =?us-ascii?q?gIKz858HnWisNuiqJbvAmhrAF7z4LNfY2ZKOZycqbbcNgHR2ROQ9xRWjRDDYOy?= =?us-ascii?q?b4UBAekPM/tGoYbhqFUDtge+BRC2Ce/z1jNEmn370Ksn2OohCwHG2wkgEsoMv3?= =?us-ascii?q?TTsNX6LqISWv2owabS1zXDafRW2Dfg44XPchEhpu2MUqh1ccXK00YvDQXFjlKQ?= =?us-ascii?q?qIH+MDOV0/4Cs2mf7+Z6Se2vjGsnphh3rzOyyMksjYzJiZgUylDC7Sh5z4c1Jc?= =?us-ascii?q?G4SE5metGoCodftyafN4duTMItXXxouD0kxb0etp67ZDIGyJUhxx7RbPyKdZWD?= =?us-ascii?q?7BH7VOuJPzt0mHZodKi8ihuy60Ss1PDwW8eu3FpXrCdJj9/BvW0X2RPJ8MiIUP?= =?us-ascii?q?5981+h2TmR0wDT7flJIUUumqraL54t274xmYEPvUjaEC/6hUf7gLKMekUr/eio?= =?us-ascii?q?7OvnYrH4qZOGK4B0jQT+Prwvmsy5H+s4LhADU3aH9em4zrHu/k30TK9UgvErnK?= =?us-ascii?q?TVqo3WKMYGqqKhBg9ayIcj6xKxDze819QYmGEKLVJCeBKblYfpPkrBL+riDfe5?= =?us-ascii?q?hFStkCxmx//DPrL7A5XNKmLPn6vmfbZ480Jc0hY8zchD55JIDbEMOO78VVX0tN?= =?us-ascii?q?zcFxM5Nw20w/37CNhmzYMfWWePAreDP6/IsF+I4PgvI+iWa4MPtjb9Matt2/m7?= =?us-ascii?q?rGEwnxcyerWuw5AXaWyjVqBnPUqxYHfhj5EGC2hc7SQkS+m/uVqeWDsbTX+oWa?= =?us-ascii?q?UtrmUqD56vCI3KXIaqkZSO2S66GttdYWUQWQPEKmvha4jRA6REUymVOMI012Vc?= =?us-ascii?q?DbU=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DpAACADmVZhqvVVdFdHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBhBOBFAefcYkejnYohU4CgzcHQxQBAQEBAQEBAQEBARIBAQEICws?= =?us-ascii?q?IKC+CMyQBgkABAQEBAgEjHQEbHQEDAQsGBQsDCgICJgICIgERAQUBHAYTihYBA?= =?us-ascii?q?w0IEJ81P4wKggQFARyDBgWDWwoZJw1Wgw4BAQEBAQEBAQIBAQEBAQEBGQIGEnm?= =?us-ascii?q?CHYNNhQWEaoMTgmEFnySHSINFiH+CY49Ck38UH4EVNoErMSEjXhqEag8QDIIDJ?= =?us-ascii?q?DYBiC0BAQE?= X-IPAS-Result: =?us-ascii?q?A0DpAACADmVZhqvVVdFdHAEBBAEBCgEBFwEBBAEBCgEBhBO?= =?us-ascii?q?BFAefcYkejnYohU4CgzcHQxQBAQEBAQEBAQEBARIBAQEICwsIKC+CMyQBgkABA?= =?us-ascii?q?QEBAgEjHQEbHQEDAQsGBQsDCgICJgICIgERAQUBHAYTihYBAw0IEJ81P4wKggQ?= =?us-ascii?q?FARyDBgWDWwoZJw1Wgw4BAQEBAQEBAQIBAQEBAQEBGQIGEnmCHYNNhQWEaoMTg?= =?us-ascii?q?mEFnySHSINFiH+CY49Ck38UH4EVNoErMSEjXhqEag8QDIIDJDYBiC0BAQE?= X-IronPort-AV: E=Sophos;i="5.40,347,1496095200"; d="scan'208";a="231246169" Received: from mail-yb0-f171.google.com ([209.85.213.171]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 11 Jul 2017 19:46:34 +0200 Received: by mail-yb0-f171.google.com with SMTP id p207so2346317yba.2 for ; Tue, 11 Jul 2017 10:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=dzNAVMYwxxR7uYEHGQbFMujV0OAwy7Ue9rlagtyQTWY=; b=NmEewBy61Zipmn9QTNFgZlFrOEpMwY+tLZmy3MbMnGk1LzKZpkdTSQSbpTEJLGQZVC I+QyUjYwKwxghNQ+d/Tx+Nym6NVcjs8wCxcAOZnQaWOR1wx0ADZdcBFoYSbNlDiOGc8o HE/gujgr2XCPfYg2mU6JsQbUgc8GbinmQUqNqUx83WrRBAISjusur71/Q6sD49PReCLQ Xet2ZtMktct0AGaouyN1DRm4OA2eswOaet9QAOGK4QFnlHs/J+wsgdqahfcuXOkZ2Auy uoR9v0Tcd8zcX8RCscLJ6ltD5xtt4ece7YTBzEx3BJyyUC7GXB9i7Dg7f3C8ZwcqsVO8 lFHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=dzNAVMYwxxR7uYEHGQbFMujV0OAwy7Ue9rlagtyQTWY=; b=DiY5YcZzcZBVM9FU7ASJuSoT96jm/Ne9CMbtbwnibSDSIasHQ/d4USEtK/V/QxnxPT 0XHGdT+qdon7WrRp8xre9iPMgb1FLmWNUcTO4zDOpiaFCXtJnfNndfBSa7pDzXFANGsD 2TIf0DVbReTdWLcDP2D1L8SGNaqwfewb5K4/XbRYUVqr+2gyHUH3AV2t5/xAEFMea+zV IfibXW8TDupl+lsvZzK15hFGSzfkMe0bCW4/ShEnVsMafcIGQGVuQ3tH8Bp3pwVNBHm6 xZe7UpBfWU33OG6oMBAbB4NVcN5XM/bJhAlwRWmoxUAueuq6dqCVxNe3d2ZjkOeDZ31Q 8OvQ== X-Gm-Message-State: AIVw1128WDrueQ4aoyM9K4MGNFzTIpDskKZ5bnvkR/xJWysQsKptEUKI qMnjgKQJ5qngnnygbasED25PdZ91Yw== X-Received: by 10.37.111.132 with SMTP id k126mr11834ybc.63.1499795193155; Tue, 11 Jul 2017 10:46:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.178.161 with HTTP; Tue, 11 Jul 2017 10:46:12 -0700 (PDT) In-Reply-To: References: <20170711125438.GP21228@nunchakus.loria.fr> From: Yotam Barnoy Date: Tue, 11 Jul 2017 13:46:12 -0400 Message-ID: To: Ivan Gotovchits Cc: Simon Cruanes , Alexey Egorov , caml users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Optimizing pure-functional streams > I've played a little bit with different optimization options in flambda 4= .04, and finally, all three versions of the loop: curried, uncurried, and t= he for-loop, have the same performance, though they still loose about 30% t= o the C version, due to tagging. Would it perhaps make sense to try Int64 in order to avoid the tagging? Also, I believe it would make sense to have Flambda try to switch to an untagged type in tight loops to avoid this tagging cost. On Tue, Jul 11, 2017 at 1:37 PM, Ivan Gotovchits wrote: > TWIMC, > > I've played a little bit with different optimization options in flambda > 4.04, and finally, all three versions of the loop: curried, uncurried, and > the for-loop, have the same performance, though they still loose about 30% > to the C version, due to tagging. > > Basically, this means, that flambda was able to get rid of the allocation= . I > don't actually know which of the options finally made the difference, but > this is how I compiled it. > > ocamlopt.opt -c -S -inlining-report -unbox-closures -O3 -rounds 8 > -inline-max-depth 256 -inline-max-unroll 1024 -o loop.cmx loop.ml > ocamlopt.opt loop.cmx -o loop.native > > > Regards, > Ivan > > > > > On Tue, Jul 11, 2017 at 8:54 AM, Simon Cruanes > wrote: >> >> Hello, >> >> Iterators in OCaml have been the topic of many discussions. Another >> option for fast iterators is https://github.com/c-cube/sequence , >> which (with flambda) should compile down to loops and tests on this kind >> of benchmark. With the attached additional file on 4.04.0+flambda, >> I obtain the following (where sequence is test-seq): >> >> $ for i in test-* ; do echo $i ; time ./$i ; done >> test-c_loop >> 5000000100000000 >> ./$i 0.08s user 0.00s system 97% cpu 0.085 total >> test-f_loop >> 5000000100000000 >> ./$i 0.10s user 0.00s system 96% cpu 0.100 total >> test-loop >> 5000000100000000 >> ./$i 0.18s user 0.00s system 97% cpu 0.184 total >> test-seq >> 5000000100000000 >> ./$i 0.11s user 0.00s system 97% cpu 0.113 total >> test-stream >> 5000000100000000 >> ./$i 0.44s user 0.00s system 98% cpu 0.449 total >> >> >> Note that sequence is imperative underneath, but can be safely used as a >> functional structure. >> >> -- >> Simon Cruanes >> >> http://weusepgp.info/ >> key 49AA62B6, fingerprint 949F EB87 8F06 59C6 D7D3 7D8D 4AC0 1D08 49AA >> 62B6 > >