From: Joern Rennecke <amylaar@spamcop.net>
To: gdb-patches@sourceware.org
Subject: RFA: use xcalloc for zalloc.
Date: Wed, 18 Mar 2009 19:40:00 -0000 [thread overview]
Message-ID: <20090318152433.4u74oma1z4sgk8g8-nzlynne@webmail.spamcop.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 97 bytes --]
This patch speeds up simulators that use the sim/common infrastructure
to allocate their memory.
[-- Attachment #2: zalloc-diff-cvs --]
[-- Type: text/plain, Size: 1633 bytes --]
regression tested for m32r-elf with check-gcc and check-gdb on gcc11 in
gcc svn & sourceware cvs from 20090317.
A simple test shows that speed for allocating large memory areas is indeed
improved on gcc11:
amylaar@gcc11:~/20090317-z$ uname -a
Linux gcc11 2.6.18-6-vserver-amd64 #1 SMP Fri Jun 6 05:50:26 UTC 2008 x86_64 GNU/Linux
amylaar@gcc11:~/20090317/bld-m32r/gcc/testsuite/gcc$ time ~/20090317/bld-m32r/sim/m32r/run --memory-region 0,0x80000000 big.x
real 0m3.180s
user 0m1.488s
sys 0m1.692s
amylaar@gcc11:~/20090317/bld-m32r/gcc/testsuite/gcc$ time ~/20090317-z/bld-m32r/sim/m32r/run --memory-region 0,0x80000000 big.x
real 0m0.069s
user 0m0.060s
sys 0m0.012s
2007-04-30 J"orn Rennecke <joern.rennecke@arc.com>
Speed up simulator startup:
* sim-utils.c (zalloc): Use xcalloc.
Index: sim/common/sim-utils.c
===================================================================
RCS file: /cvs/src/src/sim/common/sim-utils.c,v
retrieving revision 1.9
diff -p -u -r1.9 sim-utils.c
--- sim/common/sim-utils.c 14 Jan 2009 10:53:06 -0000 1.9
+++ sim/common/sim-utils.c 18 Mar 2009 18:42:18 -0000
@@ -52,15 +52,13 @@ along with this program. If not, see <h
Set by sim_resume. */
struct sim_state *current_state;
-/* Allocate zero filled memory with xmalloc - xmalloc aborts of the
+/* Allocate zero filled memory with xcalloc - xcalloc aborts if the
allocation fails. */
void *
zalloc (unsigned long size)
{
- void *memory = (void *) xmalloc (size);
- memset (memory, 0, size);
- return memory;
+ return xcalloc (1, size);
}
void
next reply other threads:[~2009-03-18 19:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 19:40 Joern Rennecke [this message]
2009-03-19 7:17 ` Doug Evans
2009-03-19 14:54 ` Joel Brobecker
2009-03-19 15:08 ` Joern Rennecke
2009-03-19 17:39 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090318152433.4u74oma1z4sgk8g8-nzlynne@webmail.spamcop.net \
--to=amylaar@spamcop.net \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox