From MAILER-DAEMON Thu Jan 08 16:35:08 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Y9KjU-0006pa-B9
	for mharc-bug-ghostscript@gnu.org; Thu, 08 Jan 2015 16:35:08 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36608)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kuszmaul@gmail.com>) id 1Y9IiM-0003Z9-GG
	for bug-ghostscript@gnu.org; Thu, 08 Jan 2015 14:25:52 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <kuszmaul@gmail.com>) id 1Y9IiL-0006mK-CS
	for bug-ghostscript@gnu.org; Thu, 08 Jan 2015 14:25:50 -0500
Received: from mail-ig0-x22a.google.com ([2607:f8b0:4001:c05::22a]:56594)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <kuszmaul@gmail.com>) id 1Y9IiL-0006mE-6l
	for bug-ghostscript@gnu.org; Thu, 08 Jan 2015 14:25:49 -0500
Received: by mail-ig0-f170.google.com with SMTP id r2so4124654igi.1
	for <bug-ghostscript@gnu.org>; Thu, 08 Jan 2015 11:25:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:sender:from:date:message-id:subject:to:content-type;
	bh=jHSxXoLWhFF7+FLEFJpaQjn8qdIlhBrF4sRKHwEB58U=;
	b=btm2n14cq+wlD5A+CJ+2l7TkxWHwplssSMztclC9pbA0gmRB6FWOdAQEtmXGXUz/Z/
	stvWc07dgFyJt+VWrVXGHB9/9/ZQPwH9ey4OLD86TU5hrfWmD6FEGRfb4543U6DQIrTH
	TdwSl/F7U0kVYu4+o191uGK+eNBuYtxV5SdgY7r5FuTD96pRCRZgW5/XX0Zfp1T7FA59
	urLjcWe7WczOzc6IOYBTwWEACSvbw4/4vF/JDjcmS8s6jDEmGfyn8dTGofjM5GgZyDzc
	twmmkY6aiJLCsqabQ4DXFHtTbATav5hKB2x/pirzVlsgv/ISwjUNeuNrS4zRaf1ma+fh
	iqSg==
X-Received: by 10.42.211.200 with SMTP id gp8mr7765982icb.93.1420745148150;
	Thu, 08 Jan 2015 11:25:48 -0800 (PST)
MIME-Version: 1.0
Sender: kuszmaul@gmail.com
Received: by 10.64.168.228 with HTTP; Thu, 8 Jan 2015 11:25:27 -0800 (PST)
From: "Bradley C. Kuszmaul" <bradley@mit.edu>
Date: Thu, 8 Jan 2015 14:25:27 -0500
X-Google-Sender-Auth: N56TY_ItHb_kp3lgtc2cPt7m2Cc
Message-ID: <CAKSyJXc+o9+GqGfcT0SAs++Bv-emNAMjHK++57k4BdkUdAEFTw@mail.gmail.com>
Subject: how to use malloc instead of the internal memory allocator
To: bug-ghostscript@gnu.org
Content-Type: multipart/alternative; boundary=20cf301d41c4df3c0a050c2901c0
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
	(bad octet value).
X-Received-From: 2607:f8b0:4001:c05::22a
X-Mailman-Approved-At: Thu, 08 Jan 2015 16:35:05 -0500
X-BeenThere: bug-ghostscript@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: "Bug reports and development for GNU GhostScript,
	the PostScript interpreter of the GNU project"
	<bug-ghostscript.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-ghostscript>,
	<mailto:bug-ghostscript-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-ghostscript>
List-Post: <mailto:bug-ghostscript@gnu.org>
List-Help: <mailto:bug-ghostscript-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-ghostscript>,
	<mailto:bug-ghostscript-request@gnu.org?subject=subscribe>
X-List-Received-Date: Thu, 08 Jan 2015 19:25:52 -0000

--20cf301d41c4df3c0a050c2901c0
Content-Type: text/plain; charset=ISO-8859-1

Hi ghostscripters,

I'm benchmarking malloc(), and I'm asking you for help for benchmarking
malloc() with ghostscript.

Historically, papers about new implementations of malloc have benchmarked
ghostscript, along with many other experiments.  They have had some trouble
measuring performance, since ghostscript uses its own allocator. For
example Evans06 says (
http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf)

> gs overwhelmingly allocates either 240-byte objects or large objects,
since it uses a custom allocator
> internally. As a result, this benchmark stresses performance of large
object allocation.

I was wondering if there is any way to convince gs to simply call malloc()
and free() for every object it wants, instead of using its internal
allocator.  I've looked (briefly) at the code in gsmalloc.c and gsmemory.c,
and it's not clear whether this is reasonable idea. The comments talk about
garbage collection and object relocation, so maybe it's just infeasible to
think of calling malloc() and free() on every object.

So here are my questions:
 1) Is the internal allocator in ghostscript used primarily for
performance, or for features such as garbage collection?
 2) Would it be possible to use malloc/free more heavily so that I can find
out how much of a performance difference there is?  How would I do that?

Any help would be appreciated.

-Bradley

--20cf301d41c4df3c0a050c2901c0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi ghostscripters,<div><br></div><div>I&#39;m benchmarking=
 malloc(), and I&#39;m asking you for help for benchmarking malloc() with g=
hostscript.</div><div><br></div><div>Historically, papers about new impleme=
ntations of malloc have benchmarked ghostscript, along with many other expe=
riments.=A0 They have had some trouble measuring performance, since ghostsc=
ript uses its own allocator. For example Evans06 says (<a href=3D"http://pe=
ople.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf">http://people.fr=
eebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf</a>)</div><div><br></div=
><div>&gt; gs overwhelmingly allocates either 240-byte objects or large obj=
ects, since it uses a custom allocator</div><div>&gt; internally. As a resu=
lt, this benchmark stresses performance of large object allocation.</div><d=
iv><br></div><div>I was wondering if there is any way to convince gs to sim=
ply call malloc() and free() for every object it wants, instead of using it=
s internal allocator.=A0 I&#39;ve looked (briefly) at the code in gsmalloc.=
c and gsmemory.c, and it&#39;s not clear whether this is reasonable idea. T=
he comments talk about garbage collection and object relocation, so maybe i=
t&#39;s just infeasible to think of calling malloc() and free() on every ob=
ject. =A0<br><br></div><div>So here are my questions:</div><div>=A01) Is th=
e internal allocator in ghostscript used primarily for performance, or for =
features such as garbage collection?</div><div>=A02) Would it be possible t=
o use malloc/free more heavily so that I can find out how much of a perform=
ance difference there is?=A0 How would I do that?</div><div><br></div><div>=
Any help would be appreciated.</div><div><br></div><div>-Bradley</div><div>=
<br></div><div><br></div><div>=A0</div></div>

--20cf301d41c4df3c0a050c2901c0--


