From owner-freebsd-hackers Sun Dec 9 2:58:10 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from bgzone.com (www.bgzone.com [217.79.65.49]) by hub.freebsd.org (Postfix) with ESMTP id 37A5937B416 for ; Sun, 9 Dec 2001 02:58:03 -0800 (PST) Received: from earth.rila.bg (root@localhost [127.0.0.1]) by bgzone.com (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) with SMTP id OAA01454 for ; Sun, 9 Dec 2001 14:58:32 +0200 Date: Sun, 9 Dec 2001 12:57:48 +0200 From: Dimitar Peikov To: hackers@freebsd.org Subject: Performance issue Message-Id: <20011209125748.3d326e32.mitko@bgzone.com> Reply-To: mitko@rila.bg Organization: 4 Net X-Mailer: Sylpheed version 0.6.5 (GTK+ 1.2.10; i386--freebsd4.4) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Sun__9_Dec_2001_12:57:48_+0200_08221800" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. --Multipart_Sun__9_Dec_2001_12:57:48_+0200_08221800 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hi, It seems to me that something in memory allocation algorith is not right. When allocate memory using malloc() without touching it FreeBSD is faster than Linuxes. But when some access to this allocated memory is needed (in most cases when have to perform calculations on huge amount of data), something is going not very well. It happends that the same program with the same input data works a times slower than on Linux box. The hardware on both machines is the same, even more Linux box has less memory. And when swapping is going to transfer data from swap area into phisical memory, I think that the things are going much slower, I mean that FreeBSD is doing this slower. I'm trying to find the difference between both implementations on both allocation algorithms, to find the answer why the things are going so. If someone can explain me in more detail both swapping and allocation algorithms currently in use in FreeBSD (I've read /usr/src/lib/libc/stdlib/malloc.c and have compl! etely agreed with it, with 1 exception), please help me. PS: I'm not trying to compare both OS-es but I'm curious on this performance issue. On FreeBSD 4.4 Stable from Nov 22 2001 -------------------------------------------- 1000000 iterations without bzero : FreeBSD$ time ./malloc_test real 0m5.706s user 0m3.169s sys 0m2.487s -------------------------------------------- 10000 iterations with bzero : FreeBSD$ time ./malloc_test real 0m47.915s user 0m12.369s sys 0m34.681s -------------------------------------------- On SuSE Linux host1 2.4.0 -------------------------------------------- 1000000 iterations without bzero : SuSE$ time malloc_test real 0m14.417s user 0m1.370s sys 0m13.040s -------------------------------------------- 10000 iterations with bzero : SuSE$ time malloc_test real 0m34.364s user 0m3.630s sys 0m30.710s -------------------------------------------- -- Dimitar Peikov Programmer Analyst Globalization Group "We Build e-Business" RILA Solutions 27 Building, Acad.G.Bonchev Str. 1113 Sofia, Bulgaria phone: (+359 2) 9797320 phone: (+359 2) 9797300 fax: (+359 2) 9733355 http://www.rila.com --Multipart_Sun__9_Dec_2001_12:57:48_+0200_08221800 Content-Type: application/octet-stream; name="malloc_test.c" Content-Disposition: attachment; filename="malloc_test.c" Content-Transfer-Encoding: base64 I2luY2x1ZGUgPHN0ZGxpYi5oPgoKI2RlZmluZSBNQUxMT0NfU0laRSAxMDI0KjEwMjQKCmludCBt YWluKGludCBhcmdjLCBjaGFyICoqYXJndikgewogIGNoYXIgKnB0cjEsICpwdHIyOwogIGludCBp OwoKICBwdHIxID0gKGNoYXIgKikgbWFsbG9jKE1BTExPQ19TSVpFKTsKICBiemVybyhwdHIxLCBN QUxMT0NfU0laRSk7CiAgZm9yIChpPTA7IGk8MTAwMDA7IGkrKykgewogICAgcHRyMiA9IChjaGFy ICopIG1hbGxvYyhNQUxMT0NfU0laRSk7CiAgICBiemVybyhwdHIyLCBNQUxMT0NfU0laRSk7CiAg ICBmcmVlKHB0cjEpOwogICAgcHRyMSA9IHB0cjI7CiAgfQogIGZyZWUocHRyMSk7Cn0K --Multipart_Sun__9_Dec_2001_12:57:48_+0200_08221800-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message