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 5A1DC80198 for ; Tue, 11 Jul 2017 20:05:34 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-it0-f45.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.45 as permitted sender) identity=mailfrom; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@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-it0-f45.google.com) identity=helo; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-it0-f45.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3Am3cjth1xZ64MhL0HsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?seMVKPad9pjvdHbS+e9qxAeQG96KtLQc06L/iOPJYSQ4+5GPsXQPItRndiQuro?= =?us-ascii?q?EopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZv?= =?us-ascii?q?JuTyB4Xek9m72/q89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tcBDXsKvg0mQeP2klKCVDpTa2+2X6?= =?us-ascii?q?I9/TE7FJmrDZzDR4ComLyOxj23HpxQZmBcC1CDC23kd4ueW6REVCXHE8h9mzlM?= =?us-ascii?q?f7G7TYgwnUW/sxPzzrBuNOzT6wUXsJvi0J5+4OiFxj8o8jkhIM2XyWCASylPlW?= =?us-ascii?q?MFXTIslPRwqEZny1qHl7Nzg/FCGMZ76PZAUwN8PpnZmb8pQ+vuUx7MK4/aAG2t?= =?us-ascii?q?Rc+rVHRsF98=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0APAQAAEmVZfy3WVdFdGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFgEBAQMBAQEJAQEBg1QBPoEBEwefcYJClVIshUoCgzcHQhUBAQEBAQE?= =?us-ascii?q?BAQEBARIBAQkLCwgmMYIzJIJCAQIDIx0BGxICCQEDDAYFCw0CAgkdAgIhAQERA?= =?us-ascii?q?QUBChIGEwgKigQBAxUQnzk/jAqCBAUBHIMGBYNbChknAwpWgw4BAQEBAQEBAQE?= =?us-ascii?q?BAQEBAQEBARkCBhJ5gh2DTYUFgleCE4MTgmEBBId8DJZhO4IjhSWDRYQRhG6CY?= =?us-ascii?q?49Ci32IAhQfgRU1gSwxISNeGoRqDxyCAyQ2AYgtAQEB?= X-IPAS-Result: =?us-ascii?q?A0APAQAAEmVZfy3WVdFdGgEBAQECAQEBAQgBAQEBFgEBAQM?= =?us-ascii?q?BAQEJAQEBg1QBPoEBEwefcYJClVIshUoCgzcHQhUBAQEBAQEBAQEBARIBAQkLC?= =?us-ascii?q?wgmMYIzJIJCAQIDIx0BGxICCQEDDAYFCw0CAgkdAgIhAQERAQUBChIGEwgKigQ?= =?us-ascii?q?BAxUQnzk/jAqCBAUBHIMGBYNbChknAwpWgw4BAQEBAQEBAQEBAQEBAQEBARkCB?= =?us-ascii?q?hJ5gh2DTYUFgleCE4MTgmEBBId8DJZhO4IjhSWDRYQRhG6CY49Ci32IAhQfgRU?= =?us-ascii?q?1gSwxISNeGoRqDxyCAyQ2AYgtAQEB?= X-IronPort-AV: E=Sophos;i="5.40,347,1496095200"; d="scan'208";a="231247464" Received: from mail-it0-f45.google.com ([209.85.214.45]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 11 Jul 2017 20:05:33 +0200 Received: by mail-it0-f45.google.com with SMTP id m68so71298121ith.1 for ; Tue, 11 Jul 2017 11:05:33 -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=UqIFkzT32id7lx0lKSTKOQJdijNNJMsJeZWaDbtPEok=; b=mb+qYzN7uUowA9PwL8bxYweijayTwutDix2X4+4xBG52FcggRSGiaZNL+7YZxG9Yw2 APrjS97uQUtB7vVs/OaW5A8oesvow3Qh9TW0CTyQpLXyuwwLLpQF6Mk5I423m94VqHmg Y5MRAt0mCKz2LTg3VbF2Lf0nKvN8C+HqHMxcFWYyVvh1IMGuCyLSmzmK1dgEscLAEkt/ ObXdYadPODix492SkWuho5F6YsAQIptpe6N+dnsHOVxZ7MNYo5hzhlMxCMzbEjMoHyhw 3Xkp2jWcXyQtebmITvHZdTfG0TG5YbnydKXvqT9gjuMJp+MloKVRfIFVtQ0LGhjYC/dt 0Cpw== 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=UqIFkzT32id7lx0lKSTKOQJdijNNJMsJeZWaDbtPEok=; b=VOA9KiY+6g5M8rnVD4HDn4Sk9yQBebwNuuJ98S6/8t1sS9sNTXib7qFgSbCqtc7gjM 3pIu1GK/Pjsdldcd7eJkWP/7HcJl2/jcBWao2+VFtoqgDaRC2sYrletlYGIFC6qN3rLV L8TxWxECreQLDQnCk0tXENsqbXR7Yz7YkfPgJG67ZSk4G9EPC9QfvCBYzmxxtaidMMYy k1Q9mRnl6r6Icfeo8JZY7hJjkTmPDQxXuZ+kFZsRinigfYqomvIV900zcCwASW1gK1JD iID+AxONuu9AKM2TTQNGIt/OPcywZtuAYC7VvN9p/L+vWfmGAQO0XqtI0FEJdc7X216Q wYEg== X-Gm-Message-State: AIVw1113xo3cH+KbNSd5cWSUx6/UPqgPXSQ+ljFiukm3Xo+ktUB37yAf LfvJM+DLBXN8H8qHZIkTg1r6O2MF9Q== X-Received: by 10.107.140.5 with SMTP id o5mr1500763iod.11.1499796331560; Tue, 11 Jul 2017 11:05:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.36.132 with HTTP; Tue, 11 Jul 2017 11:04:51 -0700 (PDT) In-Reply-To: References: <20170711125438.GP21228@nunchakus.loria.fr> From: Gabriel Scherer Date: Tue, 11 Jul 2017 14:04:51 -0400 Message-ID: To: Yotam Barnoy Cc: Ivan Gotovchits , 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 Moving from tagging to boxing does not make much sense to me, because the techniques to avoid either are similar and boxing is more expensive. It might be the case that the compiler today is better at unboxing than untagging (it currently tries to do both of these locally), but that would only be because boxing is more expensive and thus more effort was spent on the unboxing, but medium-term one could hope for a uniform approach to both transformations. On Tue, Jul 11, 2017 at 1:46 PM, Yotam Barnoy wrote: >> 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. > > 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, a= nd >> the for-loop, have the same performance, though they still loose about 3= 0% >> to the C version, due to tagging. >> >> Basically, this means, that flambda was able to get rid of the allocatio= n. 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 >> >> > > -- > 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