Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Sat, 28 Nov 2009 18:29:51 +0100 Received: by mail.proteosys.com (8.14.3/8.14.3) with ESMTP id nASHTmeY006318 for ; Sat, 28 Nov 2009 18:29:49 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id nASHQ2V1002487 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 28 Nov 2009 18:26:02 +0100 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id nAS5vXl4015472; Sat, 28 Nov 2009 18:25:56 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 358901 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Sat, 28 Nov 2009 18:25:55 +0100 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id nASHPtfC000659 for ; Sat, 28 Nov 2009 18:25:55 +0100 Received: from pluto.open.ac.uk (pluto.open.ac.uk [137.108.145.32]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id nASHPfb4002297 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 28 Nov 2009 18:25:45 +0100 Received: from laurel.open.ac.uk ([137.108.170.71]) by pluto.open.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1NER3F-0007lG-0Y for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Sat, 28 Nov 2009 17:25:41 +0000 Received: from KIELDERCMS1.open.ac.uk ([137.108.140.185]) by LAUREL.open.ac.uk ([137.108.170.71]) with mapi; Sat, 28 Nov 2009 17:25:41 +0000 Thread-Topic: object type / instance arguments Thread-Index: AcpwQkjJu+yDYf2OTy2qE7q0uU9RDQADFZOL References: <19209.8773.325233.396932@morse.mittelbach-online.de> <4B0C694B.1080803@residenset.net> <4B0E8600.6000003@residenset.net>,<19215.63158.760427.5070@morse.mittelbach-online.de> ,<4B11459C.4070305@residenset.net> Accept-Language: en-US, en-GB Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, en-GB Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id nASHPtfC000660 Message-ID: Date: Sat, 28 Nov 2009 17:25:39 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: "J.Fine" Subject: Re: object type / instance arguments To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <4B11459C.4070305@residenset.net> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-ProteoSys-SPAM-Score: -6.599 () BAYES_00,RCVD_IN_DNSWL_MED X-Scanned-By: MIMEDefang 2.65 on 213.139.130.197 Return-Path: owner-latex-l@LISTSERV.UNI-HEIDELBERG.DE X-OriginalArrivalTime: 28 Nov 2009 17:29:51.0519 (UTC) FILETIME=[644182F0:01CA7050] Status: R X-Status: X-Keywords: X-UID: 6191 Lars wrote: == J.Fine skrev: > The quadratic running time may be poison. Once that feature is > there, users may use it heavily. > > It would be sensible to estimate the running time for a dictionary > with 100 keys. Note that even this implementation is strongly linear in the number of dictionary entries; to notice the quadratic term behaviour you'd rather have to consider a dictionary where all keys are 100 characters long -- and even then you might discover that linear terms dominate the complexity, since the inner loop of what contributes that quadratic term to the complexity is TeX grabbing tokens for a macro argument. == I don't see how key length comes into it. Suppose I start with an empty dictionary and add to it 100 entries, which are not known to be different. If determining if a dictionary already has a key is linear in the number of items in the dictionary, then the running time for building a dictionary of size n is at least order n^2. What's the cost of discovering if a dictionary has a key? I suspect that the best that can be done in any language is log n, while for TeX macros it is n. Thus, the cost of create a dictionary with n entries is of order n log n in most languages, and of order n^2 for TeX macros. Thank you for correcting my syntax for allocating fontdimen memory. -- Jonathan The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302).