|
From: <sv...@va...> - 2005-12-25 02:47:19
|
Author: njn
Date: 2005-12-25 02:47:12 +0000 (Sun, 25 Dec 2005)
New Revision: 5431
Log:
A minor performance improvement -- make swizzle() faster.
Modified:
trunk/coregrind/m_mallocfree.c
Modified: trunk/coregrind/m_mallocfree.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_mallocfree.c 2005-12-24 16:34:49 UTC (rev 5430)
+++ trunk/coregrind/m_mallocfree.c 2005-12-25 02:47:12 UTC (rev 5431)
@@ -704,7 +704,12 @@
if (p_best =3D=3D NULL) return;
=20
pn =3D pp =3D p_best;
- for (i =3D 0; i < 20; i++) {
+
+ // This loop bound was 20 for a long time, but experiments showed tha=
t
+ // reducing it to 10 gave the same result in all the tests, and 5 got=
the
+ // same result in 85--100% of cases. And it's called often enough to=
be
+ // noticeable in programs that allocated a lot.
+ for (i =3D 0; i < 5; i++) {
pn =3D get_next_b(pn);
pp =3D get_prev_b(pp);
if (pn < p_best) p_best =3D pn;
|