From owner-freebsd-performance@FreeBSD.ORG Mon Feb 16 02:21:57 2004 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A73FF16A4CE for ; Mon, 16 Feb 2004 02:21:57 -0800 (PST) Received: from mail.tiscali.cz (stateless3.tiscali.cz [213.235.135.72]) by mx1.FreeBSD.org (Postfix) with ESMTP id 721B843D1D for ; Mon, 16 Feb 2004 02:21:57 -0800 (PST) (envelope-from hsn@netmag.cz) Received: from asura.bsd (213.235.70.179) by mail.tiscali.cz (6.7.021) id 402AD1D2000D5786 for freebsd-performance@freebsd.org; Mon, 16 Feb 2004 11:21:55 +0100 Received: from hsn@localhost by asura.bsd (Exim 4.24_4 FreeBSD) id 1As2d3-0000Gm-DZ for ; Sat, 14 Feb 2004 17:26:53 +0100 Date: Sat, 14 Feb 2004 17:26:53 +0100 From: Radim Kolar To: freebsd-performance@freebsd.org Message-ID: <20040214162653.GA556@asura.bsd> Mail-Followup-To: freebsd-performance@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: realloc (using forkbomb) benchmark results X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Feb 2004 10:21:57 -0000 I have tested memory allocation speed in Linux and FBSD with ports/benchmark/forkbomb. This test is doing realloc(1M) realloc(2M), ... Results are: -M writes into allocated memory, -m don't freebsd 5.2 ./forkbomb -l 64 -i 256 -M --quit 16.77s user 21.38s system 98% cpu 38.591 tota l ./forkbomb -l 64 -i 256 -m --quit > /dev/null 16.12s user 31.30s system 98% cpu 48.329 total Linux/glib2.3.2 (hsn@tty2):~/forkbomb% time ./forkbomb -l 64 -i 256 -m --quit > /dev/null 19:22 ./forkbomb -l 64 -i 256 -m --quit > /dev/null 0.00s user 0.00s system 0% cpu +0.000 total (hsn@tty2):~/forkbomb% time ./forkbomb -l 64 -i 256 -M --quit > /dev/null 19:24 ./forkbomb -l 64 -i 256 -M --quit > /dev/null 0.02s user 0.59s system 96% cpu +0.634 total Results shows: a) FBSD uses too much user time: can't extend last block while realloc()ing without copying it to other place. This should be easy to fix. b) if FBSD writes to allocated memory, results are better! Comments? c) if linux don't writes into memory, it doesn't do anything. d) linux has remap() syscall which is used for memory resizing in realloc() e) Linux uses mmap() for allocating block much larger than page. FreeBSD is doing brk() allocation. f) freebsd brk() vs linux remap() is 31 vs 0.6 sec.