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 3F0F47EE51 for ; Sun, 14 Apr 2013 15:32:59 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mmatalka@gmail.com) identity=pra; client-ip=74.125.82.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of mmatalka@gmail.com designates 74.125.82.177 as permitted sender) identity=mailfrom; client-ip=74.125.82.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@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-we0-f177.google.com) identity=helo; client-ip=74.125.82.177; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="postmaster@mail-we0-f177.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlECAJGvalFKfVKxjWdsb2JhbABQDoZevhB8CBYOAQEBAQcLCwkSBiSCFgkBAQQBIx0BGx0BAwELBgMCAwEHNwICIgERAQUBHAYTCId5AQMJBo04jySLYE+Ce4NYChknDVmIfgEFDI8LB4IugRMDlwWPLxYpg29BOg X-IPAS-Result: AlECAJGvalFKfVKxjWdsb2JhbABQDoZevhB8CBYOAQEBAQcLCwkSBiSCFgkBAQQBIx0BGx0BAwELBgMCAwEHNwICIgERAQUBHAYTCId5AQMJBo04jySLYE+Ce4NYChknDVmIfgEFDI8LB4IugRMDlwWPLxYpg29BOg X-IronPort-AV: E=Sophos;i="4.87,470,1363129200"; d="scan'208";a="13192517" Received: from mail-we0-f177.google.com ([74.125.82.177]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 14 Apr 2013 15:32:35 +0200 Received: by mail-we0-f177.google.com with SMTP id o7so901859wea.8 for ; Sun, 14 Apr 2013 06:32:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=zSuTFe3svAwTRKNCnBLrf+axD1P1bNSLXkNXj7H38gc=; b=NDauIQWTnSiwnN2Fm0GSB2Fy0kw3jlkW8aWttz2L41aT498mz0hKOjjGUMNjlRezur rvjKd/kbmG2XNaD5LHy/PFQJ/b8dXTbYHTrRu7AMM2QdzeeqnhJvhp2Z+rtdXF8Rhjv1 idaPizxmU5GISsUL3UdhNRSvcVaZqYYTRPfcKIAoFf5ZraQDli0UsiagvWR++JjBIGK1 mKU+1U59AjbKoghJ6RHKIpIImFY41SzhtRSpNxJ1StTokgWrdIUSVvBQLKDv9VN4xsqE bvi32gyvPA5Jx28+j/IsVx55Ra2hsg6j62lIXJh3+3Cz7E+jzYa9H61I9GQcjALqldns 9g8g== MIME-Version: 1.0 X-Received: by 10.180.187.206 with SMTP id fu14mr6857687wic.11.1365946355080; Sun, 14 Apr 2013 06:32:35 -0700 (PDT) Received: by 10.194.89.65 with HTTP; Sun, 14 Apr 2013 06:32:34 -0700 (PDT) Received: by 10.194.89.65 with HTTP; Sun, 14 Apr 2013 06:32:34 -0700 (PDT) In-Reply-To: <1cbcde35.47c9.13e08b6f72a.Coremail.syshen@nudt.edu.cn> References: <1cbcde35.47c9.13e08b6f72a.Coremail.syshen@nudt.edu.cn> Date: Sun, 14 Apr 2013 15:32:34 +0200 Message-ID: From: Malcolm Matalka To: =?UTF-8?B?5rKI6IOc5a6H?= Cc: caml-list Content-Type: multipart/alternative; boundary=001a11c2698046e3f104da522b40 Subject: Re: [Caml-list] [OCAML]:: the cost of List.length --001a11c2698046e3f104da522b40 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable O(n) Den 14 apr 2013 15:27 skrev "=E6=B2=88=E8=83=9C=E5=AE=87" : > Dear all: > > I have a program that run very fast. > > Recently, I add a call to List.length to this old program's inner loop, > which make it significantly slower. > > So what is the cost of List.length, is it liner to the size of the list? > or is a const? > > Shen > --001a11c2698046e3f104da522b40 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

O(n)

Den 14 apr 2013 15:27 skrev "=E6=B2=88=E8= =83=9C=E5=AE=87" <syshen@nudt= .edu.cn>:
Dear all:

I have a program that run very fast.

Recently, I add a call to List.length to this old program&#= 39;s inner loop, which make it significantly slower.

So what is the cost of List.length, is it liner to the size of the lis= t? or is a const?

Shen
--001a11c2698046e3f104da522b40--