This commit is contained in:
Looly
2024-09-30 00:02:11 +08:00
parent 5f45b2275e
commit 867e1ce55e
5 changed files with 27 additions and 21 deletions

View File

@@ -38,12 +38,6 @@ public class JsonToStringJmh {
Assertions.assertNotNull(jsonStr);
}
@Benchmark
public void gsonAppendJmh() {
final String jsonStr = gson.toString();
Assertions.assertNotNull(jsonStr);
}
@Benchmark
public void hutoolJmh() {
final String jsonStr = hutoolJSON.toString();

View File

@@ -1,6 +1,9 @@
package org.dromara.hutool.json.jmh;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import org.dromara.hutool.json.JSONObject;
@@ -49,4 +52,11 @@ public class ParseTreeJmh {
final com.alibaba.fastjson2.JSONObject jsonObject = JSON.parseObject(jsonStr);
assertNotNull(jsonObject);
}
@Benchmark
public void jacksonJmh() throws JsonProcessingException {
final ObjectMapper mapper = new ObjectMapper();
final JsonNode jsonNode = mapper.readTree(jsonStr);
assertNotNull(jsonNode);
}
}