Comments (4)
I don't think this is exactly trivial, especially assuming no_std
and no_alloc
approach. Lack of alloc
would require changes to the API; more explicit memory provisioning. Currently, Vec
s are used all over the place so algorithm can allocate as much memory as it wants at any point. Some of the Vec
s of known length can be replaced with statically allocated heapless::Vec
s or even regular arrays (putting aside const generics
being still insufficient to nicely cover this in eg. BitTree
). Additionaly, sometimes required memory depends on incoming headers/data, like eg. literal_probs
which can be as large as 6+ MB. What's your take on it? Is alloc
the only way to move forward without a complete redesign?
As for the rest, core2
crate provides the subset of std
traits that are not available within core
and are used by the project. Mostly std::io
based ones. Dependencies are no_std
either way. Strings in errors can be replaced with explicit enums and proper Display
/Debug
traits implementations. Allocations are the most problematic part.
from lzma-rs.
What's your take on it? Is
alloc
the only way to move forward without a complete redesign?
Apologies for the delay in replying.
It may be worth redesigning the implementation somewhat, to better separate the parts of the APIs that allocate data (i.e. upon reading the headers), from the core of the algorithm (which could be passed a buffer externally).
Then, the no_std
use cases could choose their allocating strategy: either depending on some alloc
implementation, or passing a static buffer - potentially limiting the available memory to less than 6MB, with the core algorithm returning an OOM error if the buffer capacity is exceeded (in the spirit of #50).
This could also play nicely with things like #72, where a buffer could be passed along with the fixed parameters (although some validation would be required to ensure the buffer indeed has the correct size for the parameters).
Strings in errors can be replaced with explicit enums and proper
Display
/Debug
traits implementations.
That's also on the radar with #6 :)
from lzma-rs.
Is there still an interest in this? Using LZMA in a no_std
setting - even if it requires alloc
- would be really helpful.
from lzma-rs.
There's somewhat rushed but functioning heapless
based lzma-rs if you need it (no alloc
, no-std
). But it's not exactly perfect. Library should be redesigned as @gendx suggests to do all of that in a saner way.
from lzma-rs.
Related Issues (20)
- Publish some benchmarks on `README.md`
- add `xz_decompress_with_options` API
- Panic on decoding xz file with sha256 checksum
- Test against the XZ test suite HOT 4
- Behavior mismatches between liblzma and lzma-rs HOT 1
- Provide features to import parts of the crate HOT 3
- Add configurable memory limit
- Support multi-stream files
- .lz (lzip) HOT 2
- Expose decoder/encoder primitives as public HOT 4
- Add unit tests
- Report code coverage
- Reach 100% coverage.
- Problems when porting lzma code Java -> Rust HOT 1
- New release
- XZ: Unknown filter id 7 HOT 2
- API Suggestion: Add encoder and decoder structs
- Extraction fails with `Unknown filter id 8` HOT 2
- lzma2_compress and zx_compress do not compress input HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lzma-rs.