Comments (10)
- Do the output buffer need to be "clean" before each operation. i.e. can i reuse buffer for every compress/uncompress operation?
from lz4-java.
Javadocs indicate that compressors and decompressors are thread safe. Looking at the code I see no synchronization, and so no state is shared or re-used. I would expect to see the same performance no matter what you do. Measure it and go for the simplest thing.
from lz4-java.
-
What is the behaviour of safe decompressor/fast decompressor if the output size is larger than the specified decompressedLength/allocated_buffer_size?
an exception is thrown or memory corruption occur?
-
Do the output buffer need to be "clean" before each operation. i.e. can i reuse buffer for every compress/uncompress operation?
On 05/07/2014 08:10 AM, broneill wrote:
Javadocs indicate that compressors and decompressors are thread safe. Looking at the code I see no synchronization, and so no state is shared or re-used. I would expect to see the same performance no matter what you do. Measure it and go for the simplest thing.
—
Reply to this email directly or view it on GitHub #41 (comment).
from lz4-java.
Why not try it out? It's not that hard to write some test code.
from lz4-java.
Other user may have similar enquiry about thread safety, scalability, error handling, buffer reuse..
if it is available in the documentation, it should benefit other user.
Furthermore, for unclean buffer: it is hard to write test scripts to prove the code work for EVERY unclean buffer, the only possible way for user is to study documentation or examine the related code himself (and he must be a C-JNI expert).
On 06/07/2014 07:04 AM, broneill wrote:
Why not try it out? It's not that hard to write some test code.
—
Reply to this email directly or view it on GitHub #41 (comment).
from lz4-java.
Good points. There are however, a few assumptions regarding the safety of Java APIs. Although the use of JNI can lead to problems, any memory corruption caused by the API is a bug. Documenting that checks are in place is just a promise anyhow, because the implementation might still be defective. The only way to be convinced of the safety is to look at the tests and look at the code.
from lz4-java.
- all APIs are thread-safe
- if the output buffer is not large enough, an exception is supposed to be thrown. If not, that is a bug. :-)
- the output buffer doesn't need to be clean before compressing or decompressing.
from lz4-java.
Thank you very much for all your help.
But why there is a need for "safe decompressor"? The fast decompressor throw exception when buffer is not large enough
from lz4-java.
The additional guarantees of the safe decompressor are not about the output buffer but the input buffer: it allows you to specify the number of bytes that it is allowed to read in order to decompress data.
from lz4-java.
thank a lot!
from lz4-java.
Related Issues (20)
- Error to decompress Lz4 that was compressed with lz4-net in C#
- Premature end of data while decompressing HOT 3
- CVE-2021-3520 Whether the vulnerability affects LZ4-Java HOT 2
- why lz aarch64 version is 1.9.1
- How to decopress large LZ4 files? HOT 1
- the value don't equal xxhsum,the value length is 15 HOT 2
- how to build 'arm64/liblz4-java.so' ? HOT 1
- Data larger than 4194304 Bytes is not decompressed correctly HOT 2
- lz4 legacy format support (typically for Linux Kernel compression) HOT 1
- LZ4 java with double buffering
- LZ4 decompression exception Malformed input at
- Exception in thread "main" net.jpountz.lz4.LZ4Exception: Malformed input at 16 HOT 3
- Add riscv support
- Stream ended prematurely when trying to readAllBytes
- Compile with frame pointers?
- Another release? HOT 5
- Enable support for riscv64 HOT 1
- JVM crashes at insertAndFindBestMatch
- Add more maintainers to `lz4-java` repo HOT 1
- add option to prefer java version when a library is hardcoded to LZ4Factory.fastestInstance
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 lz4-java.