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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id DECA980198 for ; Tue, 11 Jul 2017 20:15:32 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=yotambarnoy@gmail.com; spf=Pass smtp.mailfrom=yotambarnoy@gmail.com; spf=None smtp.helo=postmaster@mail-yb0-f175.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of yotambarnoy@gmail.com) identity=pra; client-ip=209.85.213.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="yotambarnoy@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of yotambarnoy@gmail.com designates 209.85.213.175 as permitted sender) identity=mailfrom; client-ip=209.85.213.175; receiver=mail2-smtp-roc.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 (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-yb0-f175.google.com) identity=helo; client-ip=209.85.213.175; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="yotambarnoy@gmail.com"; x-sender="postmaster@mail-yb0-f175.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AiaB+DxynGgP1ZtjXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?2usQIJqq85mqBkHD//Il1AaPBtSEraocw8Pt8InYEVQa5piAtH1QOLdtbDQizf?= =?us-ascii?q?ssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1?= =?us-ascii?q?JuPoEYLOksi7ze6/9pnRbglSmDaxfa55IQmrownWqsQYm5ZpJLwryhvOrHtIeu?= =?us-ascii?q?BWyn1tKFmOgRvy5dq+8YB6/ShItP0v68BPUaPhf6QlVrNYFygpM3o05MLwqxbO?= =?us-ascii?q?SxaE62YGXWUXlhpIBBXF7A3/U5zsvCb2qvZx1S+HNsDtU7s6RSqt4LtqSB/wiS?= =?us-ascii?q?cIKTg58H3MisdtiK5XuQ+tqwBjz4LRZoyaM+dwfr7GfdMCW2VOQtpRWSJGAoO5?= =?us-ascii?q?dYQPDuwBNvtco4Tyo1YCqB2zDhSuCuzy0D9Fnn353aM63eovEg/IwRIuEM4Bvn?= =?us-ascii?q?nPsNX1Lb0fXfypwKXUzzjOae5d1zfn6IjPdxAsufODXbVsccXLzEkkCh7IgU+K?= =?us-ascii?q?qYzjODOU1vkGvm+b7upnSeKgkWsnpBprrTi1wMcsjYnIi5kaylDB7yp5wYI1Kc?= =?us-ascii?q?ekR058ZN6pCZ1dvDyUOYtxR8MtWWBouCAix70Hv567ZikKx449yx7RcfyLa4eI?= =?us-ascii?q?4hP/VOaRPDd3n2hpd664hxa36UShyvfzVsmz0FZNtCZKjt7MtnUV2x3d9MeHV+?= =?us-ascii?q?B98Vm52TaAzwDf8OBEIUY6larcLZMq370+loILvEjdAiP7nF/6gayWe0k+5OSk?= =?us-ascii?q?9urqbq/7qpKeN4J5jBz1PL40lcylG+s4NxADX2iF9uS4073u5Uj5T69Ljv0yi6?= =?us-ascii?q?XYsIvVKdgCqq63HgNY0IYu5wywDzeh19QYkn0HI0xfdB2biIjpPknCIPH+Dfih?= =?us-ascii?q?n1ShiClny+zCM7H7AZjALmLPnKn8cbtz8UJQ1Qg+wNBH65JREL4BIfbzWkHrtN?= =?us-ascii?q?zfCx80Kwy1w+H7CNpn04MRQniAArWfMKPVsV6F/e0vI+yWa48UvDbxMeQq5/nr?= =?us-ascii?q?jXMhg18SYbGp3YcLaHC/BvlpP1+WYX/ogtsYFWcKvxE+TPDxhV2ZUT9TYm6yUL?= =?us-ascii?q?gm6jE6DoKmF4bDSZq3jLyPxifoVqFRM09PAEqNHHOgTI6EVu0BcmrGLcZriD0J?= =?us-ascii?q?Uf66QI8szxy0nAD/wrtjaOHT/3tLm4jk0Y1E4PHakFkY/CZyCNXVh3CKU2hxlG?= =?us-ascii?q?oSQTgn9K96qE15jFyE1P4r0LRjCdVP6qYRAU8BPpnGwrk/Von/?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0C3AADaFGVZhq/VVdFdGwEBAQMBAQEJA?= =?us-ascii?q?QEBFgEBAQMBAQEJAQEBhBOBARMHn3GCQpNBghEshUoCgzcHQRYBAQEBAQEBAQE?= =?us-ascii?q?BARIBAQEICwsIKC+CMySCQQEBAQECASMdARsSAgkBAwELBgULDQICCR0CAiEBA?= =?us-ascii?q?REBBQEKEgYTEooEAQMNCBCfOD+MCoIEBQEcgwYFg1sKGScDClaDDgEBAQEBAQE?= =?us-ascii?q?BAQEBAQEBAQEBGQIGEnmCHYNNhQWCV4ITgxOCYQWHfAyWYTuHSINFhBGEboJjj?= =?us-ascii?q?0KLfYgCFB+BFSYHgTQxISNeGoRqDxAMggMkNgGILQEBAQ?= X-IPAS-Result: =?us-ascii?q?A0C3AADaFGVZhq/VVdFdGwEBAQMBAQEJAQEBFgEBAQMBAQE?= =?us-ascii?q?JAQEBhBOBARMHn3GCQpNBghEshUoCgzcHQRYBAQEBAQEBAQEBARIBAQEICwsIK?= =?us-ascii?q?C+CMySCQQEBAQECASMdARsSAgkBAwELBgULDQICCR0CAiEBAREBBQEKEgYTEoo?= =?us-ascii?q?EAQMNCBCfOD+MCoIEBQEcgwYFg1sKGScDClaDDgEBAQEBAQEBAQEBAQEBAQEBG?= =?us-ascii?q?QIGEnmCHYNNhQWCV4ITgxOCYQWHfAyWYTuHSINFhBGEboJjj0KLfYgCFB+BFSY?= =?us-ascii?q?HgTQxISNeGoRqDxAMggMkNgGILQEBAQ?= X-IronPort-AV: E=Sophos;i="5.40,347,1496095200"; d="scan'208";a="283003604" Received: from mail-yb0-f175.google.com ([209.85.213.175]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 11 Jul 2017 20:15:31 +0200 Received: by mail-yb0-f175.google.com with SMTP id f194so2570522yba.3 for ; Tue, 11 Jul 2017 11:15:31 -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=xlSRqjBve56qzy+TyTjd05N50sd9E7/M5STQQsw5r+E=; b=SKEwmw1jBPg31mn2ceJw5kyZrke8ryxV+zRtouilMOxT785Gsiqaa9LfoubQKniuuF KHYlB7qnTxSvb5gtJD3r2uNx54eg70V1tgH9BNLxr4uiMYnj7TYuliT1RZMqwiAQcFfW WPZuPkD/HQ/wam2rt60ZHY0gkAdKJpmmOjBiIWP4Fc8LiNrIxQ6PKbJWwbjokKVha4yR vcJu1xA1EV+VR/uOWLng6ZiYgZtLhd9aq77NpeIagPGKMEDmQd76idZE6+6xrdgl5udI buoo83OHVjVwsun5oLneWtTRRKKYx+uG+axI8QiXviVnaRWQkgQy4dkvBEGEbc+kYmci jRlA== 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=xlSRqjBve56qzy+TyTjd05N50sd9E7/M5STQQsw5r+E=; b=oCUAWt7O/O6tZPjgkSgE2vMuviXPbOZy4mzYwCbXmLAaceT1R/QT8KnOxtjWcoKz8l cvoY/QQciEE6uQK4p1WporZD4F8W5Y2HBj1Rvl6nQ9ppjpYxqVLWp+8J2h8KX3ttgRJ9 5xsU+BybFuZYw9oXzHOLRF5/pxEfgZKY554bPkMxNWnaL5TU5hqmtnlh5cUUrwkXiGK5 XoQ3plmevrl4aD6jaIf9ms43VvoyHMNWpZIm539hQgw0K0SvBskM9a5dPg3puNlZk1la d/jkjhpIot8ieAQP6iFqs1YEjMUrMNvS8QBMWqrmeG5dxvpys/NN9COfdbG6Pywz1xDo Pb+A== X-Gm-Message-State: AIVw111sSURt39YAeWPjYpSpQuZ8cjEcvtnKg4yrvANo9u9u6JuMXp4Z fptCMjb41+0S2GrYZQOVHFmEQX6Ufw== X-Received: by 10.37.162.104 with SMTP id b95mr105339ybi.29.1499796930713; Tue, 11 Jul 2017 11:15:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.178.161 with HTTP; Tue, 11 Jul 2017 11:15:10 -0700 (PDT) In-Reply-To: References: <20170711125438.GP21228@nunchakus.loria.fr> From: Yotam Barnoy Date: Tue, 11 Jul 2017 14:15:10 -0400 Message-ID: To: Gabriel Scherer 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. Absolutely. I believe there was some skepticism expressed about the need for untagging in the past by some members of the dev team, which is why I brought it up. I suggested Int64 only because it's possible that Flambda will *currently* do better with it than with tagged integers. On Tue, Jul 11, 2017 at 2:04 PM, Gabriel Scherer wrote: > 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 wro= te: >>> 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, = 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 allocati= on. I >>> don't actually know which of the options finally made the difference, b= ut >>> 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 ki= nd >>>> 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