Skip to content

Commit 9a127b6

Browse files
committed
Use the built-in Double API of JDK to read and write double precision
1 parent 97212f0 commit 9a127b6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/java/com/github/fabienrenaud/jjb/databind/Deserialization.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.github.fabienrenaud.jjb.JsonBench;
66
import com.github.fabienrenaud.jjb.data.JsonSource;
77
import com.google.gson.JsonSyntaxException;
8+
import io.github.wycst.wast.json.options.ReadOption;
89
import org.openjdk.jmh.annotations.Benchmark;
910

1011
import java.io.IOException;
@@ -147,6 +148,6 @@ public Object quickbuf_json() throws Exception {
147148
@Benchmark
148149
@Override
149150
public Object wast() throws Exception {
150-
return io.github.wycst.wast.json.JSON.parseObject(JSON_SOURCE().nextString(), JSON_SOURCE().pojoType());
151+
return io.github.wycst.wast.json.JSON.parseObject(JSON_SOURCE().nextString(), JSON_SOURCE().pojoType(), ReadOption.UseJDKDoubleParser);
151152
}
152153
}

src/main/java/com/github/fabienrenaud/jjb/databind/Serialization.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.github.fabienrenaud.jjb.JsonBench;
66
import com.github.fabienrenaud.jjb.JsonUtils;
77
import com.github.fabienrenaud.jjb.data.JsonSource;
8+
import io.github.wycst.wast.json.options.WriteOption;
89
import okio.BufferedSink;
910
import okio.Okio;
1011
import org.openjdk.jmh.annotations.Benchmark;
@@ -179,7 +180,7 @@ public Object quickbuf_json() throws Exception {
179180
@Override
180181
public Object wast() throws Exception {
181182
ByteArrayOutputStream baos = JsonUtils.byteArrayOutputStream();
182-
io.github.wycst.wast.json.JSON.writeJsonTo(JSON_SOURCE().nextPojo(), baos);
183+
io.github.wycst.wast.json.JSON.writeJsonTo(JSON_SOURCE().nextPojo(), baos, WriteOption.WriteDecimalUseToString);
183184
return baos;
184185
}
185186
}

0 commit comments

Comments
 (0)