Skip to content

Commit 0141397

Browse files
authored
WAST: use the built-in Double API of JDK to read and write double precision (#103)
1 parent 414e760 commit 0141397

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ It covers the following libraries:
3131
* [qson](https://github.com/quarkusio/qson)
3232
* [tapestry](https://tapestry.apache.org/json.html)
3333
* [underscore-java](https://github.com/javadev/underscore-java)
34+
* [wast](https://github.com/wycst)
3435

3536
When available, both databinding and 'stream' (custom packing and unpacking) implementations are tested.
3637
Two different kinds of [models](/src/main/java/com/github/fabienrenaud/jjb/model/) are evaluated with payloads of 1, 10,

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

+2-1
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

+2-1
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)