Does it not support multithreading?
Hello, the project is very good. Recently, during testing with JMH, it was found that errors occur in multi-threaded environments. Does it currently not support multi-threaded concurrency?
Hello, the SimdJsonParser is not thread-safe. However, you can create a dedicated instance for each thread and store it in a thread-local field. This should work well in multi-threaded environments.
Hello, the
SimdJsonParseris not thread-safe. However, you can create a dedicated instance for each thread and store it in a thread-local field. This should work well in multi-threaded environments.
Hello, would you mind adding the wast library( https://github.com/wycst/wast )Compare performance
implementation("io.github.wycst:wast:0.0.23")
DOM Parser
List<JSONNode> users = JSONNode.collect(buffer, "/statuses/*/user");
Set<String> defaultUsers = new HashSet<>();
for (JSONNode user : users) {
if (user.getChildValue("default_profile", boolean.class)) {
defaultUsers.add(user.getChildValue("screen_name", String.class));
}
}
return defaultUsers.size();
Schema-Based Parser
Set<String> defaultUsers = new HashSet<>();
SimdJsonTwitter twitter = io.github.wycst.wast.json.JSON.parseObject(buffer, SimdJsonTwitter.class);
for (SimdJsonStatus status : twitter.statuses) {
SimdJsonUser user = status.user;
if (user.default_profile) {
defaultUsers.add(user.screen_name);
}
}
return defaultUsers.size();
Hi, have you run the benchmarks? If so, could you share the results?
Hi, have you run the benchmarks? If so, could you share the results?
The result of running on the Windows platform (window10 + i5 + JDK 21) https://github.com/wycst/wast-jmh-test/blob/main-openjdk23/WastJson_vs_SimdJson_TwitterJmhTest_2024_11_27_RAW.md
Benchmark Mode Cnt Score Error Units TwitterJmhTest.parseAndSelect_SimdjsonJava thrpt 5 1370.652 ± 37.171 ops/s TwitterJmhTest.parseAndSelect_WastJson thrpt 5 1997.455 ± 275.386 ops/s TwitterJmhTest.schemaBasedParseAndSelect_SimdjsonJava thrpt 5 2092.163 ± 98.596 ops/s TwitterJmhTest.schemaBasedParseAndSelect_WastJson thrpt 5 2654.975 ± 102.240 ops/s