Date: Mon, 4 Jul 2005 04:09:08 +0300 From: Nikos Ntarmos <ntarmos@ceid.upatras.gr> To: Andriy Tkachuk <andrit@ukr.net> Cc: hackers@freebsd.org Subject: Re: hot path optimizations in uma_zalloc() & uma_zfree() Message-ID: <20050704010908.GA17696@diogenis.ceid.upatras.gr> In-Reply-To: <001401c57ef0$dd489720$34bf5450@ertpc> References: <000d01c57cf7$b9b6f9f0$29931bd9@ertpc> <20050630163126.GA7365@diogenis.ceid.upatras.gr> <001401c57ef0$dd489720$34bf5450@ertpc>
next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi there. On Sat, Jul 02, 2005 at 01:27:00PM +0300, Andriy Tkachuk wrote: > here even more refereces to memory in your variant. Ummm... What compiler version are you use? The pointer variant produces faster code for me on both NetBSD/alpha (gcc 3.3.3) and Linux/x86 (gcc 3.3.5), using both -O0 and -O2 (other compiler flags also tested with similar results). Perhaps something specific to FreeBSD then? I guess I'll have to set up a FBSD box and have a look at it, when I catch up with some of the other stuff in my todo list... Anyway, the proposed optimization even makes sense if you think about it in a logical pen-and-paper way: array variant: 1. load address of element 0 of array to register A 2. load counter to register B 3. decrease register B 4. store back new decreased B 5. load (dereference) A[B] This last operation may either translate to a leal-type instruction, or to an add+load-type sequence of instructions. pointer variant: 1. load address of pointer to register A 2. decrease register A 3. store back new decreased A 4. load (dereference) A \n\n -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Nikos "Nikolai" Ntarmos <ntarmos@ceid.upatras.gr> iD8DBQFCyIw0m6J1ac+VFgoRAonNAJ0Zs4Ohl+VWyv0FzgBfGV17Kt+uswCgkkRc +u9Ly5w59makY/R2noNI3nM= =ScoK -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050704010908.GA17696>