Date: Mon, 3 Mar 2008 14:32:37 -0600 From: Brooks Davis <brooks@freebsd.org> To: gnn@freebsd.org Cc: current@freebsd.org, jasone@freebsd.org Subject: Re: Differences in malloc between 6 and 7? Message-ID: <20080303203237.GE57043@lor.one-eyed-alien.net> In-Reply-To: <7ifxv7pnei.wl%gnn@neville-neil.com> References: <677e3b3e0802280915x3f29e79cqe6093b5d7bfba975@mail.gmail.com> <7ifxv7pnei.wl%gnn@neville-neil.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
[added jasone@ to the cc list]
On Mon, Mar 03, 2008 at 03:23:33PM -0500, gnn@freebsd.org wrote:
> Hi,
>
> One of the folks I'm working with found this. The following code,
> which yes, is just an example, is 1/2 as fast on 7.0-RELEASE as on
> 6.3. Where should I look to find out why?
All of malloc lives in src/libc/stdlib/malloc.c. I know Jason has made
some changes in current so it might be worthwhile grabbing a copy from
there and seeing if this case works better there.
-- Brooks
>
> Best,
> George
>
>
> culprit continues to be arena_run_malloc, which takes several times longer
> on fbsd7 than the total of all calls to *alloc* on fbsd6.
>
> Output of uname -a:
> FreeBSD testlab5 7.0-STABLE FreeBSD 7.0-STABLE #1: Thu Feb 28 10:06:47 EST
> 2008 root@builder:/usr/obj/usr/sources/FreeBSD.7/src/sys/GENERIC amd64
>
> Program source:
> // simple test program that shows fbsd7 memory operations 2x slower than
> fbsd6
> // compile with:
> // g++ -o memory.o -c -O3 -Wall memory.cc
> // g++ -o memory memory.o -O3 -L/usr/local/lib
>
>
> class MemUser {
> public:
> void nTimesInOrder(int n) { for (int i=0; i<n; ++i) { alloc();
> freeInOrder(); } }
> void alloc();
> void freeInOrder();
> void freeRandom();
>
> private:
> char* p;
> char* ptrs[16384];
> int psize;
> };
>
> void MemUser::alloc()
> {
> int n = 0;
> // for now, allocating 1000 times at each size. Sizes are 2, 20, 200,
> 2000, 20k, 200k bytes
> for (int size=2; size <= 2e5; size *= 10) {
> for (int i=0; i<1000; ++i) {
> p = new char [size];
> ptrs[n++] = p;
> }
> }
> psize = n;
> }
>
> void MemUser::freeInOrder()
> {
> for (int i=0; i < psize; ++i) {
> delete [] ptrs[i];
> }
> }
>
>
> int main(int argc, char* argv[])
> {
> MemUser mu;
> mu.nTimesInOrder(5000);
> }
>
>
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)
iD8DBQFHzGBkXY6L6fI4GtQRAt7rAKCBtBeel5OtaykiJZKtyp+Gqr2iAgCg11za
mVXp7D2s2vWa9ofua1dVVOk=
=DH+b
-----END PGP SIGNATURE-----
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080303203237.GE57043>
