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

bam: Use libdeflate instead of the standard compress/{gzip,flate} #129

Closed
wants to merge 1 commit into from

Conversation

yasushi-saito
Copy link

It results in 2x to 4x performance improvements.

github.com/biogo/hts/bgzf

Before:
BenchmarkWrite-56 1 2087464279 ns/op
BenchmarkRead-56 1 4452965285 ns/op

After:
BenchmarkWrite-56 1 1069021742 ns/op
BenchmarkRead-56 1 1195341566 ns/op

Hardware: 56 * Xeon E5-2690@2.60GHz, 256GiB memory.

It results in 2x to 4x performance improvements.

github.com/biogo/hts/bgzf

Before:
  BenchmarkWrite-56              1        2087464279 ns/op
  BenchmarkRead-56               1        4452965285 ns/op

After:
  BenchmarkWrite-56    	       1	1069021742 ns/op
  BenchmarkRead-56     	       1	1195341566 ns/op

Hardware: 56 * Xeon E5-2690@2.60GHz, 256GiB memory.
@yasushi-saito
Copy link
Author

It addresses the issue

#124

(Most of the work was done by Chris, by the way)

@kortschak
Copy link
Member

I will be able to have a look at this in a few days.

Copy link
Member

@kortschak kortschak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can't go in as it is. The condition of adding a Cgo dependency was that it was conditional on build tags and off by default. This is always on.

@shenwei356
Copy link

Maybe you can use pgzip, I use it a lot.

gzip "github.com/klauspost/pgzip"

Go parallel gzip compression/decompression. This is a fully gzip compatible drop in replacement for "compress/gzip".

@kortschak
Copy link
Member

Yes, that's a possibility, though bgzf already uses parallelism. The alternative is "github.com/klauspost/compress/gzip" which has optimisations that I don't believe are in std.

@yasushi-saito
Copy link
Author

yasushi-saito commented Dec 17, 2018 via email

@yasushi-saito
Copy link
Author

yasushi-saito commented Dec 17, 2018 via email

@kortschak
Copy link
Member

OK. So I'll have to look at libdeflate. That will take some time.

From a quick look though, the fact that libdeflate is part of grailbio/base means that all those other packages are pulled just to get libdeflate. I'd be happier if it were in its own repo.

Also, there should be additional tests elements in the traivs matrix to check the Cgo and pure-Go implementation and documentation in bgzf to explain how to get the different builds.

Finally, I see that you have code that is derivative of Klaus' code in libdeflate.go, this should have headers showing Go Authors and Klaus' copyrights on that in addition to Grail's (also the Go and Klaus' LICENSE files).

libdeflate itself is conditional, so it builds on both cgo and pure environments (in latter, it just uses compress/flate). Does that not suffice?

@kortschak
Copy link
Member

Closing due to absence of a response.

@kortschak kortschak closed this Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants