Merge pull request #927 from metamx/speedup-smile-bytes

Improve Smile serde performance by writing binary data as is
This commit is contained in:
Charles Allen 2014-12-03 10:02:08 -08:00
commit 529e7e0272
1 changed files with 2 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package io.druid.jackson;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.smile.SmileFactory; import com.fasterxml.jackson.dataformat.smile.SmileFactory;
import com.fasterxml.jackson.dataformat.smile.SmileGenerator;
import com.google.inject.Binder; import com.google.inject.Binder;
import com.google.inject.Key; import com.google.inject.Key;
import com.google.inject.Module; import com.google.inject.Module;
@ -49,6 +50,7 @@ public class JacksonModule implements Module
public ObjectMapper smileMapper() public ObjectMapper smileMapper()
{ {
final SmileFactory smileFactory = new SmileFactory(); final SmileFactory smileFactory = new SmileFactory();
smileFactory.configure(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT, false);
smileFactory.delegateToTextual(true); smileFactory.delegateToTextual(true);
final ObjectMapper retVal = new DefaultObjectMapper(smileFactory); final ObjectMapper retVal = new DefaultObjectMapper(smileFactory);
retVal.getFactory().setCodec(retVal); retVal.getFactory().setCodec(retVal);