diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2013-08-30 15:46:12 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2013-08-30 15:46:12 +0400 |
| commit | 79dca0327ed8a7f65f3680e72cb1dcf4caaed457 (patch) | |
| tree | 450091598b2acded10db1c416e9190de5949ebec /src/cmd/ld | |
| parent | 2df3d800378fda123395609189fabdd403634d80 (diff) | |
| download | go-79dca0327ed8a7f65f3680e72cb1dcf4caaed457.tar.xz | |
libbio, all cmd: consistently use BGETC/BPUTC instead of Bgetc/Bputc
Also introduce BGET2/4, BPUT2/4 as they are widely used.
Slightly improve BGETC/BPUTC implementation.
This gives ~5% CPU time improvement on go install -a -p1 std.
Before:
real user sys
0m23.561s 0m16.625s 0m5.848s
0m23.766s 0m16.624s 0m5.846s
0m23.742s 0m16.621s 0m5.868s
after:
0m22.999s 0m15.841s 0m5.889s
0m22.845s 0m15.808s 0m5.850s
0m22.889s 0m15.832s 0m5.848s
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12745047
Diffstat (limited to 'src/cmd/ld')
| -rw-r--r-- | src/cmd/ld/lib.c | 24 | ||||
| -rw-r--r-- | src/cmd/ld/lib.h | 1 |
2 files changed, 7 insertions, 18 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index 3e8d49adaf..c400c622fa 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -801,10 +801,10 @@ ldobj(Biobuf *f, char *pkg, int64 len, char *pn, char *file, int whence) pn = estrdup(pn); - c1 = Bgetc(f); - c2 = Bgetc(f); - c3 = Bgetc(f); - c4 = Bgetc(f); + c1 = BGETC(f); + c2 = BGETC(f); + c3 = BGETC(f); + c4 = BGETC(f); Bungetc(f); Bungetc(f); Bungetc(f); @@ -882,12 +882,12 @@ ldobj(Biobuf *f, char *pkg, int64 len, char *pn, char *file, int whence) /* skip over exports and other info -- ends with \n!\n */ import0 = Boffset(f); c1 = '\n'; // the last line ended in \n - c2 = Bgetc(f); - c3 = Bgetc(f); + c2 = BGETC(f); + c3 = BGETC(f); while(c1 != '\n' || c2 != '!' || c3 != '\n') { c1 = c2; c2 = c3; - c3 = Bgetc(f); + c3 = BGETC(f); if(c3 == Beof) goto eof; } @@ -1221,16 +1221,6 @@ zerosig(char *sp) s->sig = 0; } -int32 -Bget4(Biobuf *f) -{ - uchar p[4]; - - if(Bread(f, p, 4) != 4) - return 0; - return p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); -} - void mywhatsys(void) { diff --git a/src/cmd/ld/lib.h b/src/cmd/ld/lib.h index 7ad630e1f0..f268ea13ad 100644 --- a/src/cmd/ld/lib.h +++ b/src/cmd/ld/lib.h @@ -212,7 +212,6 @@ double ieeedtod(Ieee *e); void undefsym(Sym *s); void zerosig(char *sp); void readundefs(char *f, int t); -int32 Bget4(Biobuf *f); void loadlib(void); void errorexit(void); void mangle(char*); |
