Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zstd: Load source value at start of loop #794

Merged
merged 1 commit into from
Mar 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions zstd/enc_best.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ func (e *bestFastEncoder) Encode(blk *blockEnc, src []byte) {

// nextEmit is where in src the next emitLiteral should start from.
nextEmit := s
cv := load6432(src, s)

// Relative offsets
offset1 := int32(blk.recentOffsets[0])
Expand All @@ -173,7 +172,6 @@ func (e *bestFastEncoder) Encode(blk *blockEnc, src []byte) {
blk.literals = append(blk.literals, src[nextEmit:until]...)
s.litLen = uint32(until - nextEmit)
}
_ = addLiterals

if debugEncoder {
println("recent offsets:", blk.recentOffsets)
Expand All @@ -190,6 +188,8 @@ encodeLoop:

const goodEnough = 250

cv := load6432(src, s)

nextHashL := hashLen(cv, bestLongTableBits, bestLongLen)
nextHashS := hashLen(cv, bestShortTableBits, bestShortLen)
candidateL := e.longTable[nextHashL]
Expand Down Expand Up @@ -290,7 +290,6 @@ encodeLoop:
if s >= sLimit {
break encodeLoop
}
cv = load6432(src, s)
continue
}

Expand Down Expand Up @@ -364,7 +363,6 @@ encodeLoop:
if s >= sLimit {
if debugEncoder {
println("repeat ended", s, best.length)

}
break encodeLoop
}
Expand All @@ -387,7 +385,6 @@ encodeLoop:
case 4 | 3:
offset1, offset2, offset3 = offset1-1, offset1, offset2
}
cv = load6432(src, s)
continue
}

Expand Down Expand Up @@ -435,7 +432,6 @@ encodeLoop:
e.table[h1] = prevEntry{offset: off, prev: e.table[h1].offset}
index0++
}
cv = load6432(src, s)
}

if int(nextEmit) < len(src) {
Expand Down