-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 zlib uncompress, compress support. Based partially on #553. #1206
Conversation
(I should add that I couldn't get his C wrapper code to work. Julia finds libz.so fine, but the c-wrapper code couldn't see any of the functions. I never did figure out why, but since these functions work fine in Julia, I didn't worry about it too much.) Kevin |
|
||
export compress, uncompress | ||
|
||
_jl_zlib = dlopen("libz") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can drop the _jl_
in front of library handles, now that it is in a module?
Does it make sense to have a CompressedByteArray type, and have |
This should be ready for review. Discussion on CompressedByteArray and related things here: https://groups.google.com/d/topic/julia-dev/PlZjZRBARck/discussion |
Finally figured out how to squash commits and have that appear on github! |
Is it possible to have an |
The doubling of the allocated result in This may be a larger issue over and above the basic zlib interface - whether we should have some kind of a header in the compressed array that saves the size of the uncompressed data. |
On Saturday, August 25, 2012, Viral B. Shah wrote:
I can fix up the "CompressedByteArray" branch and submit that as a separate Kevin |
I should be able to do that. I think the best way is to create a separate In reality, we need to wrap the streaming zlib interface, which will Kevin |
@ViralBShah, let me know what you think of this and what else might be needed. |
One thought: when building zlib on a 64-bit machine, it would be nice (though not necessary) to specify -64. Is there an easy way of knowing if we're on a 64-bit machine? (OpenBLAS seems to have some tests, but they seemed a little too specific.) |
I think we are in reasonable shape for a first cut. As we start using it more, we will have more clarity on the higher level interfaces (CompressedArray) and lower-level zlib functions. As for building, doesn't zlib configure detect it is on a 64-bit machine? What are the benefits of -64? |
On Sun, Aug 26, 2012 at 12:10 AM, Viral B. Shah [email protected]:
Ok, that should have been -m64, and it's not actually necessary. So, carry Kevin |
BTW, I'm in the process of finalizing/documenting this. One final change I plan to make is to split out the header stuff (similar to glpk_h.jl), so that I can use it in a separate gzip module. |
Anything else? Should I squash this to one commit? |
I am ok with merging this. Unless anyone says otherwise, I will merge it in a day or so. |
Okay, really done now. I switched the types to the expected corresponding julia types, and added a test to make sure they match the compile types of zlib. The functions are a bit cleaner this way, IMHO. |
I think this makes more sense as a single, squashed commit. I don't think the refactoring history will be much use in master. |
Done! |
Initial zlib uncompress, compress support. Based partially on #553.
RIght now, this only includes compress and uncompress functions. These are a "high-level" interface in zlib. @choffstein had originally started writing a wrapper in C around these functions, but it turns out they are easily callable directly from Julia. Lower level C functions offering more control of the compression/decompression process are available, but require passing of structs, and therefore may be more challenging to interact with without a C wrapper.
I've exposed a number of zlib.h internal constants. Most of these are not used by compress/uncompress and related functions. Some are used by the gzip related functions, and some are used by lower-level functions that I'm not planning to implement right now (though someone else should feel free to if they have a need). I do have julia wrapper functions for almost all of the gzip file functions, along with an IOStream-like interface. I'll send a pull request for that once this gets through comments (or package it separately in its own repo).
Question of the day: this depends on zlib, another C library. It's a pretty core library in many places, but is it something you want as part of the main distribution, or should it be put into a separate module?
Kevin