-
Notifications
You must be signed in to change notification settings - Fork 31
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
Stateless Huffman #8
Comments
I think I'm going to take a look at this, this weekend. |
An FYI, I've migrated to an essentially stateless Huffman decoding implementation in #35. |
So this should be closed? |
Nope, we still have a stateful encoder. |
I can try to write it in C if that helps. |
I would like to avoid us having any native extensions in this module at this time. |
Even optionally? |
Tentatively, yes, I'm opposed to having an optional native extension. My thinking on this is a bit complex, so let me lay it out.
The TL;DR here, I think, is that right now I'm about -0.25 on having a native extension. If we could come up with a nice Rust extension then I'd reconsider, but I'd really rather not maintain a C extension if it can possibly be avoided. |
In fact, let state an outline of what we'd need to make me happy here. If any contributor can write a Rust extension that can be optionally compiled if a buildchain is present, that flags its presence or absence clearly in a module-scoped dunder variable, that uses CFFI, and that doesn't vomit a load of output into the terminal on install on systems that do not have a Rust toolchain present, I'd be willing to consider merging such an extension. |
It shouldn't be much of a problem with https://github.com/novocaine/rust-python-ext |
I've already written a Rust extension module in Python, that's not the hard bit. The harder bits are a) making it fail gracefully, b) keeping it maintained, and c) actually writing the extension. ;) |
Right, this might take some effort since I'm not very familiar with Rust's lifelines and borrow semantics. I will give it a shot though. |
As discussed with @Lukasa the Huffman encoder / decoder is currently initialized using two static structures defined in huffman_constants.py. We could potentially remove the need for this pseudo-stateful nature and instead have a completely stateless Huffman encoder / decoder with the addition of another static structure related to decoding (encoding is currently trivial to make stateless). This may also offer a minor performance enhancement.
The text was updated successfully, but these errors were encountered: