-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Initial implementation of zlib #548
Conversation
My biggest concern here is the memory management and who is responsible for the underlying strings. I think I have matched things up with the finalizers, but I would love it someone a bit more experienced could poke through zlib_wrapper and zlib.jl to make sure there aren't any unforeseen circumstances where there could be a memory leak. Also, I don't think this is the most efficient, or correct, implementation of zlib -- especially with how I "inflate" the data (via realloc). I am sure someone knows a better way. |
Cool, thanks! I'll take a look at some point. |
@choffstein Any specific reason why only strings, or is it just a starting point? Presumably, we can use zlib to compress any serialized data in julia, arrays of Numbers, etc. - although it is questionable how much compression one would get. |
Every other zlib library I have run across works has only worked with byte arrays (often implemented via string types -- see: http://www.ruby-doc.org/stdlib-1.9.3/libdoc/zlib/rdoc/Zlib/Deflate.html#method-c-deflate). My experience tends to be: take a data structure, serialize it to some sort of byte array format / string (JSON, XML, proprietary), deflate it, store / send it, inflate it, then deserialize. It seems like the appropriate way to reduce coupling and increase cohesion is to make the zlib library take a single input type. That way it is agnostic of the type of information being passed in -- all it needs to know is that it is a byte array (or, String). So, theoretically, the whole thing can be changed to:
|
Thanks! The core compress method should operate on a |
Can you rebase this onto master so that the commits are cleaner? |
See #553 |
Remove unnecessary convert(Vector, wv) calls
This is an initial implementation of deflating and inflating a string, implemented with zlib.