diff --git a/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsParseUTF8Bytes.java b/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsParseUTF8Bytes.java index 185ffd68ca..5e7b8e990d 100644 --- a/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsParseUTF8Bytes.java +++ b/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsParseUTF8Bytes.java @@ -58,6 +58,10 @@ public void gson(Blackhole bh) throws Exception { ); } + public void wast(Blackhole bh) { + bh.consume(io.github.wycst.wast.json.JSON.parseObject(utf8Bytes, Clients.class)); + } + public static void main(String[] args) throws RunnerException { Options options = new OptionsBuilder() .include(ClientsParseUTF8Bytes.class.getName()) diff --git a/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsWriteUTF8Bytes.java b/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsWriteUTF8Bytes.java index 5017470fae..8698cb807b 100644 --- a/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsWriteUTF8Bytes.java +++ b/benchmark/src/main/java/com/alibaba/fastjson2/benchmark/jjb/ClientsWriteUTF8Bytes.java @@ -46,6 +46,11 @@ public void fastjson2(Blackhole bh) { bh.consume(JSON.toJSONBytes(clients)); } + @Benchmark + public void wast(Blackhole bh) { + bh.consume(io.github.wycst.wast.json.JSON.toJsonBytes(clients)); + } + public void jsonb(Blackhole bh) { bh.consume(JSONB.toBytes(clients)); } diff --git a/benchmark/src/test/java/com/alibaba/fastjson2/benchmark/jjb/ClientsParseUTF8BytesTest.java b/benchmark/src/test/java/com/alibaba/fastjson2/benchmark/jjb/ClientsParseUTF8BytesTest.java index 698d8f0d29..9ae0a7b170 100644 --- a/benchmark/src/test/java/com/alibaba/fastjson2/benchmark/jjb/ClientsParseUTF8BytesTest.java +++ b/benchmark/src/test/java/com/alibaba/fastjson2/benchmark/jjb/ClientsParseUTF8BytesTest.java @@ -13,13 +13,28 @@ public static void fastjson2() { } long millis = System.currentTimeMillis() - start; System.out.println("fastjson2 millis : " + millis); - // zulu17.40.19 : 2850 2815 2777 2770 2730 2704 2717 2661 2638 2603 2587 2662 2582 2441 + // zulu17.40.19 : 2417 // oracle-jdk-17.0.6 : // oracle-jdk-17.0.6_vec : // oracle-jdk-17.0.6_reflect : 3566 3513 3476 } } + public static void wast() { + for (int j = 0; j < 5; j++) { + long start = System.currentTimeMillis(); + for (int i = 0; i < 1000 * 1000; ++i) { + benchmark.wast(BH); + } + long millis = System.currentTimeMillis() - start; + System.out.println("wast millis : " + millis); + // zulu17.40.19 : 2087 + // oracle-jdk-17.0.6 : + // oracle-jdk-17.0.6_vec : + // oracle-jdk-17.0.6_reflect : + } + } + public static void dsljson() throws Exception { for (int j = 0; j < 5; j++) { long start = System.currentTimeMillis(); @@ -44,7 +59,8 @@ public static void jackson() throws Exception { } public static void main(String[] args) throws Exception { - fastjson2(); + wast(); +// fastjson2(); // dsljson(); // jackson(); } diff --git a/benchmark/src/test/java/com/alibaba/fastjson2/benchmark/jjb/ClientsWriteUTF8BytesTest.java b/benchmark/src/test/java/com/alibaba/fastjson2/benchmark/jjb/ClientsWriteUTF8BytesTest.java index 57a326f85d..c9b22c3122 100644 --- a/benchmark/src/test/java/com/alibaba/fastjson2/benchmark/jjb/ClientsWriteUTF8BytesTest.java +++ b/benchmark/src/test/java/com/alibaba/fastjson2/benchmark/jjb/ClientsWriteUTF8BytesTest.java @@ -46,6 +46,21 @@ public static void fastjson2() { } } + public static void wast() { + for (int j = 0; j < 5; j++) { + long start = System.currentTimeMillis(); + for (int i = 0; i < 1000 * 1000; ++i) { + benchmark.wast(BH); + } + long millis = System.currentTimeMillis() - start; + System.out.println("ClientsWriteUTF8Bytes-wast millis : " + millis); + // zulu8.70.0.23 : + // zulu17.40.19 : 1364 + // zulu17.40.19_vec : + // zulu17.40.19_reflect : + } + } + public static void fastjson2_str() { for (int j = 0; j < 5; j++) { long start = System.currentTimeMillis(); @@ -83,7 +98,8 @@ public static void jackson() throws Exception { } public static void main(String[] args) throws Exception { - fastjson2(); +// fastjson2(); + wast(); // jsonb(); // jsonb_beanToArray(); // fastjson2_str();