gtoubassi / femtozip Goto Github PK
View Code? Open in Web Editor NEWFemtoZip is a "shared dictionary" compression library optimized for small documents that may not compress well with traditional tools such as gzip
License: Other
FemtoZip is a "shared dictionary" compression library optimized for small documents that may not compress well with traditional tools such as gzip
License: Other
I have a slightly proprietary example I can give you (contact me at ehrmann+1923 <at> gmail).
What happened was that I base 64 encoded a byte array after compressing it, converted it to lower case, decoded it back to a byte array, then tried to decompress it. compressionModel.decompress(data) took much longer than it should have, then the JVM ran out of memory. There's a chance Femtozip is correctly decoding what becomes a massive byte array, but it could also be a bug.
A nice workaround might be to have a maxExpectedSize parameter on decompress to guard against this.
FemtoZipCompressionModel fmtCompressionModel = new FemtoZipCompressionModel(); fmtCompressionModel.setMaxDictionaryLength(dictionaryLength); fmtCompressionModel.build(trainingDocs);
Dictionarylength is set to 64*1024
Hello,
After installing the required dependencies on a fresh Ubuntu install I'm getting this error when attempting to use the fzip command line tool:
fzip: error while loading shared libraries: libfzip.so.0: cannot open shared object file: No such file or directory
Could not find an email address to contact "gtoubassi" so leaving a note here.
The wiki mentions its in use in production at a PHP site but there is no PHP module. Is this built but not released?
I'm not a C/C++ programmer and tried to tackle creating a PHP PECL extension but ran into the following problems:
A) The C++ library has no error checking or exception handling for all error cases.
B) Throws error on invalid model file (passing a non-existing file). This was fixed by checking file.good().
C) Throws error on broken model file (passing a file but not a valid model). I could not catch the error in C++ using try/catch so not sure what's going on. Again, I have little experience in C++.
D) Throws error on decompression of a string that is not a valid femtozip compressed string.
My half-baked PHP PECL module works only in a perfect environment where everything passed to it is perfect but would like the ability to handle real-world usage where bad data is throw at it and be able to recover and not crash due to errors.
Would love to have femtozip working in production and need some assistance.
When provided with a large quantity of files/data, femtozip gets into an infinite loop. This issue can be tracked down to the insert(int, int*, int*, size_t)
method in IntSet.h
.
inline int insert(int n, int *b, int *end, size_t capacity) {
int *p = b + (n % capacity);
while (*p != -1) {
if (*p == n) {
return 0;
}
p++;
if (p == end) {
p = b;
}
}
*p = n;
return 1;
}
The loop while (*p != -1)
never completes as p
is never equal to -1
or n
.
Hi,
first of all: Kudos go to the library developers.
I stumbled upon the following issue: I'm currently trying to load a CompressionModel, which I saved via the Java Library to the C++ Library. This doesn't seem to work. I guess that's due to the fact that Java stores bytes differently than C++.
Any hints how I can make this work?
Thanks a lot,
Simon
Hi, when I finished building FemtoZip, I try to create sdch dictionary by " fzip --model /tmp/sdch-data/dict --build --dictonly --maxdict 96000 /tmp/sdch-data/train". Unfortunately, it failed with Segmentation fault (core dumped).The error message is as follows:
Program terminated with signal 11, Segmentation fault.
#0 0x00007f9ef217f41f in bsarray (buf=0x0, p=0x17ba1a0, n=0) at sarray.c:155
155 c = buf[n-1] << 8;
I don't know where things go wrong. Can you help me? Thanks a lot.
Why does this method encode a four-byte offset when offset is only two bytes?
public void encodeSubstring(int offset, int length, Object context) {
...
offset = -offset;
if (offset < 1 || offset > (2<<15)-1) {
throw new IllegalArgumentException("Offset " + offset + " out of range [1, 65535]");
}
encoder.encodeSymbol(offset & 0xf);
encoder.encodeSymbol((offset >> 4) & 0xf);
encoder.encodeSymbol((offset >> 8) & 0xf);
encoder.encodeSymbol((offset >> 12) & 0xf);
...
}
For build and unit testing purposes, I migrated the build of the java project from ant to maven.
Would you accept a PR?
Do you expect your application/lib to work with binary data?
In your examples, you are always referring to text data.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.