Skip to content

Commit

Permalink
Use the built-in Double API of JDK to read and write double precision
Browse files Browse the repository at this point in the history
  • Loading branch information
wycst committed May 4, 2024
1 parent 97212f0 commit 9a127b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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 9a127b6

Please sign in to comment.