Skip to content

Commit

Permalink
WAST: use the built-in Double API of JDK to read and write double pre…
Browse files Browse the repository at this point in the history
…cision (#103)
  • Loading branch information
wycst committed May 4, 2024
1 parent 414e760 commit 0141397
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ It covers the following libraries:
* [qson](https://github.com/quarkusio/qson)
* [tapestry](https://tapestry.apache.org/json.html)
* [underscore-java](https://github.com/javadev/underscore-java)
* [wast](https://github.com/wycst)

When available, both databinding and 'stream' (custom packing and unpacking) implementations are tested.
Two different kinds of [models](/src/main/java/com/github/fabienrenaud/jjb/model/) are evaluated with payloads of 1, 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.github.fabienrenaud.jjb.JsonBench;
import com.github.fabienrenaud.jjb.data.JsonSource;
import com.google.gson.JsonSyntaxException;
import io.github.wycst.wast.json.options.ReadOption;
import org.openjdk.jmh.annotations.Benchmark;

import java.io.IOException;
Expand Down Expand Up @@ -147,6 +148,6 @@ public Object quickbuf_json() throws Exception {
@Benchmark
@Override
public Object wast() throws Exception {
return io.github.wycst.wast.json.JSON.parseObject(JSON_SOURCE().nextString(), JSON_SOURCE().pojoType());
return io.github.wycst.wast.json.JSON.parseObject(JSON_SOURCE().nextString(), JSON_SOURCE().pojoType(), ReadOption.UseJDKDoubleParser);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.github.fabienrenaud.jjb.JsonBench;
import com.github.fabienrenaud.jjb.JsonUtils;
import com.github.fabienrenaud.jjb.data.JsonSource;
import io.github.wycst.wast.json.options.WriteOption;
import okio.BufferedSink;
import okio.Okio;
import org.openjdk.jmh.annotations.Benchmark;
Expand Down Expand Up @@ -179,7 +180,7 @@ public Object quickbuf_json() throws Exception {
@Override
public Object wast() throws Exception {
ByteArrayOutputStream baos = JsonUtils.byteArrayOutputStream();
io.github.wycst.wast.json.JSON.writeJsonTo(JSON_SOURCE().nextPojo(), baos);
io.github.wycst.wast.json.JSON.writeJsonTo(JSON_SOURCE().nextPojo(), baos, WriteOption.WriteDecimalUseToString);
return baos;
}
}

0 comments on commit 0141397

Please sign in to comment.