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

png files (gopher subpackage) double-gzip'd #1

Closed
extemporalgenome opened this issue Jun 22, 2012 · 2 comments
Closed

png files (gopher subpackage) double-gzip'd #1

extemporalgenome opened this issue Jun 22, 2012 · 2 comments

Comments

@extemporalgenome
Copy link

The png format already uses zlib internally for compression -- compressing it again is very unlikely to provide additional compression, and requires additional processing (once for your decompression, another time for the image library to decompress the png's pixels).

Large byte slices may also cause pathological behavior in the gc compiler (memory use ballooning). https://github.com/jteeuwen/go-bindata specializes in making sure the given binary file is compiled into a readonly memory segment without the major adverse effects -- though again, gzipping png files is best avoided.

@BurntSushi
Copy link
Owner

Ah, I did not know go-bindata had added an option to not compress data. (Haven't go get'd it in a while.)

I tried this out with the gopher image, and image/png.Decode is giving me an unexpected EOF error. When I go back to go-bindata with compression, things work. I'm going to do a bit more digging before I report this to go-bindata.

Large byte slices may also cause pathological behavior in the gc compiler (memory use ballooning). https://github.com/jteeuwen/go-bindata specializes in making sure the given binary file is compiled into a readonly memory segment without the major adverse effects -- though again, gzipping png files is best avoided.

Duly noted. This isn't a problem with the gopher package, since it's a toy only used in the examples. However, I'll keep an eye out for this in Wingo, where I'm using embedded binary data for fonts and images when nothing else is available.

Thanks! :-)

@BurntSushi
Copy link
Owner

I've removed embedded resources from Wingo since it ended up behaving exactly as you said it might: memory use ballooned during compilation. (Around ~2GB.)

As such, I'm closing this. Whether the gopher image is embedded properly is of no consequence to me here. It's small and only used in the examples.

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

No branches or pull requests

2 participants