[erlang-patches] JInterface: don't compress external binary format if this increases the size

Nico Kruber <>
Mon Jan 28 20:13:16 CET 2013


On Friday 25 Jan 2013 16:33:44 you wrote:
> Hi all,
> recently, I noticed, that if I compress an erlang term from Java to external
> binary format, e.g. "[]" (empty list), it is larger than the result
> returned by term_to_binary/2 with compression activated, e.g.
> term_to_binary([], [compressed,6}]).
> 
> I digged a bit deeper and saw that erts_term_to_binary in external.c covers
> that case and if a compressed external term would be bigger than the
> uncompressed version, it returns the uncompressed one.
> 
> Please have a look:
> https://github.com/NicoK/otp/compare/maint...maint_jinterface.dont_compress_if_size_increased
> https://github.com/NicoK/otp/compare/maint...maint_jinterface.dont_compress_if_size_increased.patch
> 
> 
> Nico

Turns out, it wasn't just as simple as I thought - but after my latest additions in the above-mentioned branches, everything should be fine again.
And while I was at it, I also added a method where you can specify the compression level.


Nico


More information about the erlang-patches mailing list