Subject: Re: lower RAM usage with xsltproc
To: None <tech-pkg@NetBSD.org, netbsd-docs@NetBSD.org>
From: Simas Mockevicius <symka@NetBSD.org>
List: tech-pkg
Date: 05/13/2005 10:47:50
--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Don't know why, but on my server, where I work with htdocs
generation of autolayout.xml works without patches very well
and quickly.
Simas.
On Fri, May 13, 2005 at 12:25:48AM +0200, Klaus Heinz wrote:
> Hi,
>=20
> appended is a patch Hiroki Sato provided for textproc/libxslt (applies
> to both current pkgsrc as well as pkgsrc-2005Q1).
> This patch can dramatically reduce duplicate memory allocation for DTDs
> if document() is used extensively in a stylesheet. The best example for
> this is generating htdocs/autolayout.xml with and without the patch.
>=20
> I would like to get some more feedback whether this works for other
> stylesheets people use, so please apply this patch (save it as
> pkgsrc/textproc/libxslt/patches/patch-ac, "make mps", then build) and
> test your stylesheets with the new xsltproc binary.
>=20
> ciao
> Klaus
> --- libxslt/documents.c.orig 2004-08-17 07:49:56.000000000 +0900
> +++ libxslt/documents.c 2005-05-07 12:27:33.000000000 +0900
> @@ -255,6 +255,7 @@
> xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) {
> xsltDocumentPtr ret;
> xmlDocPtr doc;
> + xmlDtdPtr intSubset, extSubset;
> =20
> if ((ctxt =3D=3D NULL) || (URI =3D=3D NULL))
> return(NULL);
> @@ -312,6 +313,24 @@
> if (ctxt->debugStatus =3D=3D XSLT_DEBUG_NONE)
> xmlXPathOrderDocElems(doc);
> =20
> + extSubset =3D doc->extSubset;
> + intSubset =3D doc->intSubset;
> +
> + if (intSubset =3D=3D extSubset)
> + extSubset =3D NULL;
> +
> + if (extSubset !=3D NULL) {
> + xmlUnlinkNode((xmlNodePtr) doc->extSubset);
> + doc->extSubset =3D NULL;
> + xmlFreeDtd(extSubset);
> + }
> +
> + if (intSubset !=3D NULL) {
> + xmlUnlinkNode((xmlNodePtr) doc->intSubset);
> + doc->intSubset =3D NULL;
> + xmlFreeDtd(intSubset);
> + }
> +
> ret =3D xsltNewDocument(ctxt, doc);
> return(ret);
> }
--YiEDa0DAkWCtVeE4
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)
iD8DBQFChFumUtlifAEIUUgRAlYbAKCJQLOPKjoljFLhTQXz+OC9Przq8wCfcJFO
slixEok74dRqllM+XKt7xzY=
=4y9P
-----END PGP SIGNATURE-----
--YiEDa0DAkWCtVeE4--