Quite strangely, the JDK's GZip is winning vs these fancy compression algorithms:
Json size: 2727kb Json time: 26.426ms Smile size: 1043kb Smile time: 20.366ms Compressed Smile size: 914kb Compressed Smile time: 20.678ms GZip size: 216kb GZip time: 53.393ms And for a reasonable price to pay, I'm happy with this now ;-) On Saturday, November 24, 2018 at 6:46:45 PM UTC, [email protected] wrote: > > I cannot set input/output decorators to the SmileFactory, I get exceptions > when I do that, the following is working but it is a shame I cannot use the > SmileFactory + decorators: > > public static final ObjectMapper SNAPPY_OBJECT_MAPPER; > public static final Charset UTF8=Charset.forName("UTF-8"); > > > static{ > final JsonFactory jsonFactory=new JsonFactory(); > jsonFactory.setInputDecorator(new InputDecorator() > { > @Override > public InputStream decorate(IOContext context,InputStream > inputStream) throws IOException > { > return new FramedSnappyCompressorInputStream(inputStream); > } > > > @Override > public InputStream decorate(IOContext context,byte[] bytes,int > offset,int length) throws IOException > { > return new FramedSnappyCompressorInputStream(new > ByteArrayInputStream(bytes,offset,length)); > } > > > @Override > public Reader decorate(IOContext context,Reader reader) throws > IOException > { > return new InputStreamReader(new FramedSnappyCompressorInputStream > (new ReaderInputStream(reader)),UTF8); > } > }); > > > jsonFactory.setOutputDecorator(new OutputDecorator() > { > @Override > public OutputStream decorate(IOContext context,OutputStream > outputStream) throws IOException > { > return new FramedSnappyCompressorOutputStream(outputStream); > } > > > @Override > public Writer decorate(IOContext context,Writer writer) throws > IOException > { > return new OutputStreamWriter(new > FramedSnappyCompressorOutputStream(new WriterOutputStream(writer,UTF8))); > } > }); > > > SNAPPY_OBJECT_MAPPER=new ObjectMapper(jsonFactory). > disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES). > disable(SerializationFeature.FAIL_ON_EMPTY_BEANS). > setSerializationInclusion(JsonInclude.Include.NON_NULL). > disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS). > registerModule(INT_RANGE_MODULE). > registerModule(JODA_MODULE). > registerModule(TAGS_MODULE); > } > > > This is not a JMH brenchmark but I made sure I warmed before I took these > times: > > Json size: 1743kb > Json time: 17.322ms > > > Smile size: 624kb > Smile time: 12.619ms > > > Compressed Smile size: 556kb > Compressed Smile time: 12.003ms > > > Snappy size: 196kb > Snappy time: 89.368ms > > Guido. > -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
