Revert "Use larger buffer to speed things up"

This reverts commit f999d52e7e.
This commit is contained in:
Miek Gieben 2012-01-05 13:24:11 +01:00
parent b1f8529bbb
commit 0877df185c
2 changed files with 17 additions and 44 deletions

View File

@ -26336,4 +26336,6 @@ miek.nl. 345600 IN NS ext.ns.whyscream.net.
miek.nl. 345600 IN NS open.nlnetlabs.nl. miek.nl. 345600 IN NS open.nlnetlabs.nl.
miek.nl. 345600 IN NS omval.tednet.nl. miek.nl. 345600 IN NS omval.tednet.nl.
miek.nl. 345600 IN NS elektron.atoom.net. miek.nl. 345600 IN NS elektron.atoom.net.
2miek.nl. 345600 IN RRSIG SOA 8 2 345600 20110823011301 20110724011301 12051 miek.nl. r7f+/sWHR8g8y50XHDzOaOjXlpixIzUzBDbOVkCKhnOKhgSHeudWxCF7ZsfxfWNTe2kRgPJeVSgAWOc9KnPAORbBEpRAO6LtzQrqi99yuVTTNCL0+7+LwTLlG6kYkAGctJzlWEvEjCyN+r8Kq9sKa9VZSegQHxHsdCfCMsjR/3U= 2miek.nl. 345600 IN RRSIG SOA 8 2 345600 20110823011301 20110724011301 12051 miek.nl. r7f+/sWHR8g8y50XHDzOaOjXlpixIzUzBDbOVkCKhnOKhgSHeudWxCF7ZsfxfWNTe2kRgPJeVSgAWOc9KnPAORbBEpRAO6LtzQrqi99yuVTTNCL0+7+LwTLlG6kYkAGctJzlWEvEjCyN+r8Kq9sKa9VZSegQHxHsdCfCMsjR/3U= ;{id = 12051}
;; Added 6275 DS records (percentage was 25) to 10000 NS RRset's (from input-zone: 0, from added: 10000)
;; lines in original input-zone: 64

View File

@ -296,24 +296,14 @@ func zlexer(r io.Reader, c chan lex) {
rrtype := false rrtype := false
owner := true owner := true
brace := 0 brace := 0
stop := false
p, q := 0, 0 p, q := 0, 0
buf := make([]byte, MaxMsgSize) buf := make([]byte, MaxMsgSize)
n, err := r.Read(buf) n, err := r.Read(buf)
if err == io.EOF { for err != io.EOF {
stop = true
}
l.column = 0 l.column = 0
l.line = 1 // Yeah, start at one l.line = 0
for {
l.column++
switch buf[q] { switch buf[q] {
case ' ', '\t': case ' ', '\t':
// Awkward
if buf[q] == '\t' { // Tabs are eight
// Go to the first tabstop
l.column = (1 + (l.column / 8)) * 8
}
escape = false escape = false
if commt { if commt {
p++ p++
@ -375,8 +365,6 @@ func zlexer(r io.Reader, c chan lex) {
commt = true commt = true
case '\n': case '\n':
// Hmmm, escape newline // Hmmm, escape newline
l.line++
l.column = 0
escape = false escape = false
if commt { if commt {
// Reset a comment // Reset a comment
@ -485,42 +473,25 @@ func zlexer(r io.Reader, c chan lex) {
// tok, err = r.ReadByte() read extra bytes // tok, err = r.ReadByte() read extra bytes
q++ q++
if q > n-1 { // Funny, 'cause q starts at zero if q > n-1 { // Funny, 'cause q starts at zero
if stop {
break
}
// println("N", n)
// Read in a new chunk. Every thing before p // Read in a new chunk. Every thing before p
// can be discarded. // can be discarded.
// println("PQ", p, q, string(buf[p:q]))
n1 := copy(buf, buf[p:]) n1 := copy(buf, buf[p:])
// println("copied n1", n1)
// Reset the indices // Reset the indices
q = q - p q = q - p
p = 0 p = 0
// Read a new chunk // Read a new chunk
n2, err := r.Read(buf[n1:]) n, err = r.Read(buf[n1:])
if err != nil {
// println("OOK NOG een error")
// println("err", err.Error())
if err == io.EOF {
stop = true
}
}
n = n1 + n2/// JAJAJA
// println("****Wat heb ik", string(buf[:q]), "Q", "n:", n)
// println("****Wat heb ik", string(buf[:q+10]), "Q")
// println("wat is n nu", n)
} }
} }
// It this need anymore??? // It this need anymore???
// println("pq", p, q) /*
if p != q { if p != q {
// println("OVER", string(buf[p:q])) // Send remainder
l.token = string(buf[p:q]) l.token = string(buf[p:q])
l.value = _STRING l.value = _STRING
c <- l c <- l
} }
*/
} }
func stringToTtl(l lex, t chan Token) (uint32, bool) { func stringToTtl(l lex, t chan Token) (uint32, bool) {