From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/80283 Path: news.gmane.org!not-for-mail From: Philipp Gesang Newsgroups: gmane.comp.tex.context Subject: Re: [***Spam/VIR***] Re: Layer vs. overlay Date: Wed, 16 Jan 2013 14:34:29 +0100 Message-ID: <20130116133429.GC553@phlegethon.router_intern> References: <3608C682-5ACB-4006-9CC7-9D848CB5BFC0@gmail.com> <37BA1BD5-D127-4A53-887A-92F5C19FF3A0@gmail.com> <10BF7AFF-32C7-4C8C-A1C6-538C9EB591EA@gmail.com> <20130116114721.GB553@phlegethon.router_intern> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1229011536==" X-Trace: ger.gmane.org 1358343286 32536 80.91.229.3 (16 Jan 2013 13:34:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Jan 2013 13:34:46 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Jan 16 14:35:02 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TvT8u-0000HN-Hg for gctc-ntg-context-518@m.gmane.org; Wed, 16 Jan 2013 14:35:00 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E3F6A101F9; Wed, 16 Jan 2013 14:34:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id eh0LY4fJJvew; Wed, 16 Jan 2013 14:34:40 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id BE8F3101E5; Wed, 16 Jan 2013 14:34:40 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 88E58101E5 for ; Wed, 16 Jan 2013 14:34:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 8K9-+-lnzjvu for ; Wed, 16 Jan 2013 14:34:38 +0100 (CET) Original-Received: from filter4-ams.mf.surf.net (filter4-ams.mf.surf.net [192.87.102.72]) by balder.ntg.nl (Postfix) with ESMTP id 99742101E2 for ; Wed, 16 Jan 2013 14:34:38 +0100 (CET) Original-Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by filter4-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r0GDmkuv008065 for ; Wed, 16 Jan 2013 14:48:46 +0100 Original-Received: from ix.urz.uni-heidelberg.de (cyrus-portal.urz.uni-heidelberg.de [129.206.100.176]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r0GDYbU7008811 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 16 Jan 2013 14:34:37 +0100 Original-Received: from extmail.urz.uni-heidelberg.de (extmail.urz.uni-heidelberg.de [129.206.100.140]) by ix.urz.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id r0GDYbmg001467 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 16 Jan 2013 14:34:37 +0100 Original-Received: from localhost (p50846C67.dip.t-dialin.net [80.132.108.103]) (authenticated bits=0) by extmail.urz.uni-heidelberg.de (8.13.4/8.13.1) with ESMTP id r0GDYZlt013156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Wed, 16 Jan 2013 14:34:36 +0100 Mail-Followup-To: mailing list for ConTeXt users In-Reply-To: X-Operating-System: Linux phlegethon 3.6.8-1-ARCH User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=129.206.210.211; country=DE; latitude=51.0000; longitude=9.0000; http://maps.google.com/maps?q=51.0000,9.0000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 01IMBMKby - 90d55bce1857 - 20130116 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.72 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:80283 Archived-At: --===============1229011536== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yVhtmJPUSI46BTXb" Content-Disposition: inline --yVhtmJPUSI46BTXb Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7=C2=B7 > Hello, >=20 > On Wed, 16 Jan 2013 12:47:21 +0100, Philipp Gesang wrote: >=20 > >Lookup the correct string from a table? >=20 > thanks for the idea - >=20 > - in other words, we have to keep running results somewhere; Yes, this is simple because the order of processing doesn=E2=80=99t change -- as long as the data you aggregate fits into your memory, of course! > the algorithm fills a table with texts for each page, and each > \setlayer takes one value back, so we can simplify to: >=20 > \setlayer[beforetext][preset=3Drighttop] > {\framed[width=3D2in]{\directlua{context(table.remove(userdata.LPr.= texts, 1))}}} > context.startTEXpage { background =3D "foreground,beforetext" } > table.insert(userdata.LPr.texts, "BEF" .. i) >=20 > context.externalfigure({"cow"},{width=3D"30cm"}) > context.stopTEXpage() =46rom my tests calling table.remove() to remove the first element in a list is extremely inefficient compared to accessing an array. (For 10^5 elements it=E2=80=99s 1m41.644s vs. 0m0.030s on my machine.) While we=E2=80=99re at it, table.insert() involves an extra function call that carries another perfomance penalty, albeit a much smaller one. Your code should do the same, though. Regards Philipp --yVhtmJPUSI46BTXb Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iEYEARECAAYFAlD2rGUACgkQ02lYlJYWs9JbVACfSIqwNo7dLNe4l94Z6OV8qmqK KIkAniGpoTcTH5W+uZHg7Ku0e5KAHUNH =7B0G -----END PGP SIGNATURE----- --yVhtmJPUSI46BTXb-- --===============1229011536== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============1229011536==--