From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 5FA6FBBAF for ; Tue, 3 Nov 2009 02:29:29 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqsBALwV70rRVdSvkWdsb2JhbACCITKYRD8BAQEBCQsKBxMDsDsKgS+FRYhoAQMDBYQ4BIkk X-IronPort-AV: E=Sophos;i="4.44,671,1249250400"; d="scan'208";a="37432867" Received: from mail-vw0-f175.google.com ([209.85.212.175]) by mail3-smtp-sop.national.inria.fr with ESMTP; 03 Nov 2009 02:29:28 +0100 Received: by vws5 with SMTP id 5so1474632vws.1 for ; Mon, 02 Nov 2009 17:29:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=4AE7Ce4rXniXgBjGhUpBNjCok2g/nN76Q/XIa4uBZIg=; b=SJTPGGYkzl23N9yz76kIMLVaiUOoxw+h22eY9tB8R3zn4zKW7gN6U/IH0sD8LJRe/L GVzf0uGt8ec5prGfFKDloaJ5fk+k0YPrNlv+8F+ePBofpTqXVueZhkHgpMwzEHRN1BQW FlOPHRobtbDCBooHFyHir7KgQEkmRVsmNZQnQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type; b=vPCfwTWbp+DFBgYMOR22oWcHmFTMzpL9Hna5VgxBuUyNcCmQIK8cZuvmGdGYFJM5xb 7bRdryLyfUOsJTgEbgJAL1W225omqohsrbg/xBSV24f7QT2KaB6eI4rfIUwbqyFTPTCn OMDAeUtyZCws5N6Y2UfjMqkGxQDMhcHgzPADU= MIME-Version: 1.0 Received: by 10.220.3.211 with SMTP id 19mr301551vco.67.1257211762934; Mon, 02 Nov 2009 17:29:22 -0800 (PST) Reply-To: yminsky@gmail.com In-Reply-To: <4AEF3B55.2060604@univ-savoie.fr> References: <8F7FB895-BC42-49C6-BAB3-4EDDF761C78B@inria.fr> <4AEF3B55.2060604@univ-savoie.fr> Date: Mon, 2 Nov 2009 20:29:22 -0500 Message-ID: <891bd3390911021729i2abfe6aby953afaa4ba8c07e@mail.gmail.com> Subject: Re: [Caml-list] tip for tail recursive map From: Yaron Minsky To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=001517576d908a17a304776d6c1c X-Spam: no; 0.00; recursive:01 yaron:01 minsky:01 yminsky:01 ocaml:01 node:01 unrolling:01 bounded:01 ocaml:01 node:01 unrolling:01 bounded:01 blog:98 blog:98 stack:01 --001517576d908a17a304776d6c1c Content-Type: text/plain; charset=ISO-8859-1 I put a post on our blog a little while back discussing this. http://ocaml.janestreet.com/?q=node/71 There are a number of tricks you can do, including loop unrolling, and using a counter to keep track of the number of stack frames, to get code that behaves well on small-to-medium lists, uses a bounded number of stack frames, and is faster than the standard List.map even for small lists. y --001517576d908a17a304776d6c1c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I put a post on our blog a little while back discussing this.=A0

= =A0=A0 http://ocaml.ja= nestreet.com/?q=3Dnode/71

There are a number of tricks you can d= o, including loop unrolling, and using a counter to keep track of the numbe= r of stack frames, to get code that behaves well on small-to-medium lists, = uses a bounded number of stack frames, and is faster than the standard List= .map even for small lists.

y
--001517576d908a17a304776d6c1c--