From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1EHGrP-0006Ta-Vq for garchives@archives.gentoo.org; Mon, 19 Sep 2005 08:18:48 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id j8J8CdPw012923; Mon, 19 Sep 2005 08:12:39 GMT Received: from callisto.cs.kun.nl (callisto.cs.kun.nl [131.174.33.75]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id j8J8CdsJ009639 for ; Mon, 19 Sep 2005 08:12:39 GMT Received: from localhost (localhost [127.0.0.1]) by callisto.cs.kun.nl (Postfix) with ESMTP id 69C802E80C4 for ; Mon, 19 Sep 2005 10:18:13 +0200 (CEST) From: Paul de Vrieze To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] PATCH: gentoolkit: Make portage.config object a global object Date: Mon, 19 Sep 2005 10:18:02 +0200 User-Agent: KMail/1.8.2 References: <1126889948.30603.16.camel@txslpc1d36.wkst.vzwnet.com> <200509170809.10192.jstubbs@gentoo.org> <432B643A.3030106@egr.msu.edu> In-Reply-To: <432B643A.3030106@egr.msu.edu> X-Face: #Lb+'V@sGJ;ptgo5}V"W+5OCoo{LZv;bh,s,`WKLi/J)ed1_$0;6X<=?utf-8?q?700LVV/=3BLqPhiDP=5E=0A=09=27f=5Dfnv?=@%6M8\'HR1t=aFx;ePfp{ZQoBe+e)JOQ8T5*(_;mHY+cltLGq<;@$Y,=?utf-8?q?O=5C=24=0A=09Tm=23G6M?=,g![Q62J{na*S9d;R[^8pc%u\aiLqU@`kJtYl"^6pxdW Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart5913243.IlJzcNnv50"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200509191018.11247.pauldv@gentoo.org> X-Archives-Salt: 6a9a606a-f674-4137-9664-b3d7e748120b X-Archives-Hash: 6609eab4cce21f9c7d79a5d405ab0e5a --nextPart5913243.IlJzcNnv50 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Saturday 17 September 2005 02:32, Alec Warner wrote: > Jason Stubbs wrote: > > On Saturday 17 September 2005 01:59, Paul Varner wrote: > >>http://bugs.gentoo.org/show_bug.cgi?id=3D90680 > >> > >>Author: Paul Varner > >> > >>The current implementation of gentoolkit creates a portage.config > >> object for every package object that it creates. While this is the > >> correct thing to do from an object-oriented programming point of > >> view, this implementation consumes an excessive amount of memory and > >> CPU. The proposed patch changes the portage.config object for each > >> package object to point to a single global object. > >> > >>If no one sees any serious issues with the patch, I will be placing > >> it into gentoolkit. > > > > I tried doing this once before locally, but found some issue with it. > > Unfortunately, I can't remember what that issue was. If you are > > calling setcpv() for every call to the package object that utilizes > > the config object and no utilizing packages (in gentoolkit or > > otherwise) are utilizing threading, it should theoretically be okay. > > Actually, I think it was the threading issue that delayed the fix. > > I can't remember the model for this, but there is some logic along the > lines of intercepting config object writes with setattr and then > cloning the config object. That way if the config is read-only only 1 > is instantiated, but if you attempt to modify it, the config would > clone itself, then proceed with the modification and return the cloned > copy. Not sure how easy that would be to implement, perhaps some sort > of wrapper class? To share such an object the right way from an OO perspective would require= =20 to pass the object along at package object instanciation. I doubt though=20 that the config object should be modified. But if it must in some cases a=20 lazy copy scheme is probably most efficient. You'd probably have the=20 editing code do something like: this->editableConfig()->changeAttribute(...) Where the editableConfig function checks whether a copy has been made, if=20 so, it will just use that copy, else it will make a copy and return it. Paul =2D-=20 Paul de Vrieze Gentoo Developer Mail: pauldv@gentoo.org Homepage: http://www.devrieze.net --nextPart5913243.IlJzcNnv50 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) iD8DBQBDLnRDbKx5DBjWFdsRAkqcAKDJF/MICMWXdF/Dc3qlbSI32XXgKwCcCiKM 9zwTu0AqNhW0wYDs1QOQWto= =xBwM -----END PGP SIGNATURE----- --nextPart5913243.IlJzcNnv50-- -- gentoo-portage-dev@gentoo.org mailing list