From: "Sean E. Russell" Date: 2006-02-01T12:06:58+09:00 Subject: Re: Question about massive API changes --nextPart1782446.HgIADprT8N Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tuesday 31 January 2006 14:44, mathew wrote: > > What do you mean by an API facade? > > Something that accepts calls via the old API, and translates them into > appropriate calls into the new API. I thought that's what you meant. Unfortunately, that's not the API I'm=20 talking about. In REXML, currently, you can do this: el.attributes['someatt'] =3D "foo" el.attributes['someatt'] << "bar" el.attributes['someatt'] =3D=3D "foobar" # true I can do this, because the attributes are being stored as Attribute objects= ,=20 even though you get back String objects from attributes[]. To get the spac= e=20 saving, I'm only generating Attribute objects when the user makes an API ca= ll=20 that returns an Attribute object; otherwise, I store the original String=20 objects, which are less than 1/3 the size of an Attribute object. Dependin= g=20 on the XML document, this can save a significant amount of memory. The sam= e=20 trick will be applied to Text nodes, for even more savings. On my average= =20 document survey, for example, I get about a 50% space improvement. See: http://www.germane-software.com/repos/rexml/branches/memory_attributes/benc= hmarks/memoryuse/stats.svg for a *very* rough benchmark. (trunk) is the current REXML memory use, (gn= s)=20 is the optimized use, with just Attributes using optimized. This isn't something I can put a fa=E7ade on -- at least, not without wreck= ing=20 the memory gain. As soon as I create a non-primitive object out of it, I=20 lose the gain. > Having seen the response to suggestions of incorporating versioning and > RubyGems into Ruby, I think I could hazard a guess... I didn't see anybody objecting to the versioning aspect of RubyGems; just t= he=20 package management aspect of it. In fact, I clearly remember some vocal=20 insistence that the best thing would be to separate versioning from package= =20 management, where it doesn't belong... but that discussion is pass=E9. =2D-=20 =2D-- SER "As democracy is perfected, the office of president represents,=20 more and more closely, the inner soul of the people. On some=20 great and glorious day the plain folks of the land will reach=20 their heart's desire at last and the White House will be adorned=20 by a downright moron." - H.L. Mencken (1880 - 1956) --nextPart1782446.HgIADprT8N Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2-ecc0.1.6 (GNU/Linux) iD8DBQBD4CPAP0KxygnleI8RAh8yAKCKC/BT3hZ8ZbWlYCVqdCQDzeC7pwCgo6zV HjpwKHmXS6Zpd3bkSPXuzEg= =5UQB -----END PGP SIGNATURE----- --nextPart1782446.HgIADprT8N--