diff options
author | alex <alex@FreeBSD.org> | 1998-11-02 00:14:50 +0000 |
---|---|---|
committer | alex <alex@FreeBSD.org> | 1998-11-02 00:14:50 +0000 |
commit | 7f75b60ff72c53340c909c11f916e63201f46c99 (patch) | |
tree | a892d0ca696f8b9a958171d7a6fc6a60896d2046 /sys/alpha | |
parent | c5e67afa1a61d6c1e01f73349271c2c6a7dcb7e0 (diff) | |
download | FreeBSD-src-7f75b60ff72c53340c909c11f916e63201f46c99.zip FreeBSD-src-7f75b60ff72c53340c909c11f916e63201f46c99.tar.gz |
Optimize bzero() by unrolling the aligned quadword loop and moving the length
manipulation away from the length comparison. Measurements on beast.cdrom.com
show >3X improvement over the original code on large block sizes, putting the
performance on par with the optimized assembly code in libc.
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/alpha/machdep.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 9374444..d604ad2 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: machdep.c,v 1.18 1998/10/15 22:00:54 dfr Exp $ + * $Id: machdep.c,v 1.19 1998/10/30 05:41:07 msmith Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -1029,10 +1029,22 @@ bzero(void *buf, size_t len) *p++ = 0; len--; } + while (len >= sizeof(u_long) * 8) { + *(u_long*) p = 0; + *((u_long*) p + 1) = 0; + *((u_long*) p + 2) = 0; + *((u_long*) p + 3) = 0; + len -= sizeof(u_long) * 8; + *((u_long*) p + 4) = 0; + *((u_long*) p + 5) = 0; + *((u_long*) p + 6) = 0; + *((u_long*) p + 7) = 0; + p += sizeof(u_long) * 8; + } while (len >= sizeof(u_long)) { *(u_long*) p = 0; - p += sizeof(u_long); len -= sizeof(u_long); + p += sizeof(u_long); } while (len) { *p++ = 0; |