aboutsummaryrefslogtreecommitdiff
path: root/src/bufio/scan.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2023-09-16 23:18:02 +0700
committerShulhan <m.shulhan@gmail.com>2024-01-25 04:01:14 +0700
commit004f47502ca074bd2591e215512fd2e18bd8659a (patch)
treeb06ecdc41cdc20b4e4c1eaa259b75e67d0d75aae /src/bufio/scan.go
parent8d542a8e8899ca4b1aa5b1d112c83f13c6ecb535 (diff)
downloadgo-004f47502ca074bd2591e215512fd2e18bd8659a.tar.xz
bufio: realign struct Scannerbench-before
This reduce the Scanner allocation size from 112 to 72 bytes.
Diffstat (limited to 'src/bufio/scan.go')
-rw-r--r--src/bufio/scan.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bufio/scan.go b/src/bufio/scan.go
index a26b2ff17d..ce4c1721d4 100644
--- a/src/bufio/scan.go
+++ b/src/bufio/scan.go
@@ -29,12 +29,12 @@ import (
type Scanner struct {
r io.Reader // The reader provided by the client.
split SplitFunc // The function to split the tokens.
- maxTokenSize int // Maximum size of a token; modified by tests.
+ err error // Sticky error.
token []byte // Last token returned by split.
buf []byte // Buffer used as argument to split.
+ maxTokenSize int // Maximum size of a token; modified by tests.
start int // First non-processed byte in buf.
end int // End of data in buf.
- err error // Sticky error.
empties int // Count of successive empty tokens.
scanCalled bool // Scan has been called; buffer is in use.
done bool // Scan has finished.