From owner-cvs-src@FreeBSD.ORG Sat Jul 1 16:51:12 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D652B16A412; Sat, 1 Jul 2006 16:51:12 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5318943D7E; Sat, 1 Jul 2006 16:51:11 +0000 (GMT) (envelope-from jasone@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k61GpBrj006153; Sat, 1 Jul 2006 16:51:11 GMT (envelope-from jasone@repoman.freebsd.org) Received: (from jasone@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k61GpBLq006143; Sat, 1 Jul 2006 16:51:11 GMT (envelope-from jasone) Message-Id: <200607011651.k61GpBLq006143@repoman.freebsd.org> From: Jason Evans Date: Sat, 1 Jul 2006 16:51:11 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/lib/libc/stdlib malloc.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Jul 2006 16:51:12 -0000 jasone 2006-07-01 16:51:11 UTC FreeBSD src repository Modified files: lib/libc/stdlib malloc.c Log: Use some math tricks in arena_run_reg_dalloc() to avoid actual division, as well as avoiding a switch statement. This change has no significant impact to performance when branch prediction is successful at predicting the sizes of objects passed to free(), but in the case that the object sizes are semi-random, this change has the potential to prevent many branch prediction misses, thus improving performance substantially. Take advantage of alignment guarantees in ipalloc(), and pad object sizes to something less than a power of two when possible. This has the potential to substantially reduce internal fragmentation for objects allocated via posix_memalign(). Avoid an unnecessary pow2_ceil() call in arena_ralloc(). Submitted by: djam8193ah@hotmail.com Revision Changes Path 1.129 +90 -83 src/lib/libc/stdlib/malloc.c