FAQ

On Sunday, 3 April 2016 03:45:24 UTC+2, Nigel Tao wrote:

I'd prefer only replacing level 1, and leaving 2 and 3 alone,
especially since, AFAICT,

https://go-review.googlesource.com/#/c/21021/4/src/compress/flate/deflatefast.go
still has a lot of copy/paste between encodeL1, encodeL2 and encodeL3.
If you prefer that, I will keep the "encodeL2".

encodeL3 does not have any duplicate code, except the first few lines.
"encodeL1" and "encodeL2" share some code, and encodeL1 could be achieved
by just not copying the buffer on each call and calling encodeL2. However,
you would lose all the speed gained, except the memcpy. We could look at
the possibility of swapping two encoding buffers in the future, so we can
keep a reference to the previous block, and avoid the memcpy.

I will remove all but encodeL2, and make that level 1, and restore the
previous level 2+3. I am in the middle of starting a new job, so it may
take a little time, but I hope we can get it finalized before the 1.7
lockdown.

FWIW, my reading of that discussion thread is that Steinar Gunderson
(one of the C++ snappy authors) reckons that while it's much better
throughput on binary data and slightly worse on textual data, the "1 +
((s - lit) >> 5)" skipping algorithm is a net negative for the C++
implementation, so I'm less inclined to adopt it for the Go
implementation, whether in golang/snappy or in compress/flate.
Yes, it is not a clear-cut win/lose. On some archs, I would expect the
subtraction to be faster than a separate variable, not so much on others.
It really depends on register allocation, etc.

I will add the "conservative" skipping. Another change I have to make is
to make writeBlockDynamic able to output raw bytes if the bitcount is
smaller for storing it uncompressed. That should also make random data
faster to make up for the conservative skipping.

/Klaus

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 17 of 20 | next ›
Discussion Overview
groupgolang-dev @
categoriesgo
postedMar 22, '16 at 10:53a
activeApr 10, '16 at 2:06p
posts20
users10
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase