Skip to content

Instantly share code, notes, and snippets.

private static final BufferRecyclerPool STRIPED_JCTOOLS_INSTANCE = new StripedPool(JCToolsPool::new, 4);
private static final BufferRecyclerPool STRIPED_LOCK_FREE_INSTANCE = new StripedPool(BufferRecyclerPool.LockFreePool::nonShared, 4);
static class StripedPool implements BufferRecyclerPool {
private static final long PROBE = getProbeOffset();
private final int mask;
Benchmark (acquireDelay) (objectSize) (poolStrategy) Mode Cnt Score Error Units
JacksonWriteVanilla.writePojoMediaItem 0 large NO_OP thrpt 20 784596.886 ± 734.270 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large THREAD_LOCAL thrpt 20 2572762.547 ± 15741.397 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large LOCK_FREE thrpt 20 2487224.084 ± 32952.142 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large CONCURRENT_DEQUEUE thrpt 20 2336025.521 ± 35176.403 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large JCTOOLS thrpt 20 2216228.211 ± 38447.527 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large STRIPED_LOCK_FREE thrpt 20 2442370.234 ± 27381.171 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large STRIPE
Benchmark (acquireDelay) (objectSize) (poolStrategy) Mode Cnt Score Error Units
JacksonWriteVanilla.writePojoMediaItem 0 large STRIPED_LOCK_FREE thrpt 20 2442370.234 ± 27381.171 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large STRIPED_JCTOOLS thrpt 20 2400320.771 ± 12634.878 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 small STRIPED_LOCK_FREE thrpt 20 11151206.516 ± 205137.550 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 small STRIPED_JCTOOLS thrpt 20 10884847.997 ± 254872.601 ops/s
JacksonWriteVanilla.writePojoMediaItem 10 large STRIPED_LOCK_FREE thrpt 20 2449302.227 ± 17819.357 ops/s
JacksonWriteVanilla.writePojoMediaItem 10 large STRIPED_JCTOOLS thrpt 20 2419230.845 ± 39950.726 ops/s
JacksonWriteVanilla.writePojoMediaItem 10 small STRIPED_LOCK_FRE
Benchmark (acquireDelay) (objectSize) (poolStrategy) Mode Cnt Score Error Units
JacksonWriteVanilla.writePojoMediaItem 0 large NO_OP thrpt 20 784596.886 ± 734.270 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large THREAD_LOCAL thrpt 20 2572762.547 ± 15741.397 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large LOCK_FREE thrpt 20 2487224.084 ± 32952.142 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large CONCURRENT_DEQUEUE thrpt 20 2336025.521 ± 35176.403 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 large JCTOOLS thrpt 20 2216228.211 ± 38447.527 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 small NO_OP thrpt 20 803785.767 ± 1208.431 ops/s
JacksonWriteVanilla.writePojoMediaItem 0 small THR
package com.fasterxml.jackson.perf.json;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.util.BufferRecycler;
import com.fasterxml.jackson.core.util.BufferRecyclerPool;
import com.fasterxml.jackson.jr.ob.JSON;
import com.fasterxml.jackson.perf.model.MediaItems;
import com.fasterxml.jackson.perf.util.NopOutputStream;
import org.jctools.queues.MpmcUnboundedXaddArrayQueue;
import org.openjdk.jmh.annotations.Benchmark;
class JCToolsPool implements BufferRecyclerPool {
static final BufferRecyclerPool INSTANCE = new JCToolsPool();
private final MpmcUnboundedXaddArrayQueue<BufferRecycler> queue = new MpmcUnboundedXaddArrayQueue<>(8);
@Override
public BufferRecycler acquireBufferRecycler() {
BufferRecycler bufferRecycler = queue.poll();
return bufferRecycler != null ? bufferRecycler : new BufferRecycler();
Benchmark (objectSize) (poolStrategy) Mode Cnt Score Error Units
JacksonWriteVanilla.writePojoMediaItem large NO_OP thrpt 10 789648.182 ± 1409.682 ops/s
JacksonWriteVanilla.writePojoMediaItem large THREAD_LOCAL thrpt 10 2584773.101 ± 8467.604 ops/s
JacksonWriteVanilla.writePojoMediaItem large LOCK_FREE thrpt 10 2481777.471 ± 1492.957 ops/s
JacksonWriteVanilla.writePojoMediaItem large CONCURRENT_DEQUEUE thrpt 10 2313321.282 ± 21133.877 ops/s
JacksonWriteVanilla.writePojoMediaItem large JCTOOLS thrpt 10 783654.863 ± 834.517 ops/s
JacksonWriteVanilla.writePojoMediaItem large JCTOOLS_RELAXED thrpt 10 785805.894 ± 2466.177 ops/s
JacksonWriteVanilla.writePojoMediaItem small NO_OP thrpt 10 803714.649 ± 2655.246 ops/s
JacksonWriteVanilla.writePojoMediaItem small THREAD_LOCAL thrpt
[INFO] org.kie.kogito:explainability-service-messaging:jar:2.0.0-SNAPSHOT
[INFO] +- io.quarkus:quarkus-smallrye-health:jar:2.16.10.Final:compile
[INFO] | +- io.smallrye:smallrye-health:jar:3.3.1:compile
[INFO] | | +- org.eclipse.microprofile.health:microprofile-health-api:jar:3.1:compile
[INFO] | | +- io.smallrye:smallrye-health-api:jar:3.3.1:compile
[INFO] | | +- io.smallrye.config:smallrye-config:jar:2.13.3:compile
[INFO] | | | \- io.smallrye.config:smallrye-config-core:jar:2.13.3:compile
[INFO] | | | +- org.eclipse.microprofile.config:microprofile-config-api:jar:2.0.1:compile
[INFO] | | | +- io.smallrye.common:smallrye-common-expression:jar:1.13.2:compile
[INFO] | | | | \- io.smallrye.common:smallrye-common-function:jar:1.13.2:compile
@Test
public void testFromGlobalWithDuplicates() throws Exception {
String str =
"import java.util.concurrent.atomic.AtomicInteger;\n" +
"import " + NamedPerson.class.getCanonicalName() + ";\n" +
"global java.util.List list \n" +
"rule R when \n" +
" $i : AtomicInteger()\n" +
" $o : NamedPerson(age > $i.get()) from list\n" +
"then \n" +
@Test
public void testFromGlobalWithDuplicates() throws Exception {
String str =
"import java.util.concurrent.atomic.AtomicInteger;\n" +
"import " + StringWrapper.class.getCanonicalName() + ";\n" +
"global java.util.List list \n" +
"rule R when \n" +
" $i : AtomicInteger()\n" +
" $o : StringWrapper(length > $i.get()) from list\n" +
"then \n" +