@Test
    void perfTest(@TempDir Path tempDir) {
        int entryCount = 5_000;
        int refStreamDefCount = 5;
        int keyValueMapCount = 20;
        int batchSize = 1_000;
        final Instant baseTime = Instant.now().truncatedTo(ChronoUnit.DAYS);

        // refStrmIdx => mapNames
        final Map<Integer, List<String>> mapNamesMap = new HashMap<>(refStreamDefCount);
        final List<Instant> lookupTimes = new ArrayList<>(refStreamDefCount);

        try (final TemporalStateDb db = TemporalStateDb.create(tempDir, BYTE_BUFFERS, BASIC_SETTINGS, false)) {
            db.write(writer -> {
                for (int refStrmIdx = 0; refStrmIdx < refStreamDefCount; refStrmIdx++) {
                    final List<String> mapNames = mapNamesMap.computeIfAbsent(refStrmIdx,
                            k -> new ArrayList<>(keyValueMapCount));

                    // The time loaded into the store
                    final Instant strmTime = baseTime.minus(refStrmIdx, ChronoUnit.DAYS);
                    // The time we use to lookup with, i.e. a smidge after the strm time in the store
                    final Instant lookupTime = strmTime.plus(5, ChronoUnit.SECONDS);
                    lookupTimes.add(lookupTime);

                    for (int mapIdx = 0; mapIdx < keyValueMapCount; mapIdx++) {
                        final String mapName = buildMapName(KV_TYPE, mapIdx);
                        mapNames.add(mapName);
                        for (int keyIdx = 0; keyIdx < entryCount; keyIdx++) {
                            final KeyPrefix key = buildKey(keyIdx);
                            final String val = buildKeyStoreValue(mapName, keyIdx, key);

                            final TemporalKey k = TemporalKey.builder().prefix(buildKey(keyIdx)).time(strmTime).build();
                            final Val v = ValString.create(val);

                            db.insert(writer, new TemporalState(k, v));
                        }
                    }
                }
            });
        }

        try (final TemporalStateDb db = TemporalStateDb.create(
                tempDir,
                BYTE_BUFFERS,
                new TemporalStateSettings.Builder().build(),
                true)) {
            final Random random = new Random(892374809);
            final Runnable work = () -> {
                final int refStrmIdx = random.nextInt(refStreamDefCount);
                final int mapIdx = random.nextInt(keyValueMapCount);
                final int keyIdx = random.nextInt(entryCount);
                final String mapName = mapNamesMap.get(refStrmIdx).get(mapIdx);
                final KeyPrefix key = buildKey(keyIdx);
                final Instant time = lookupTimes.get(refStrmIdx);

                final TemporalStateRequest request = new TemporalStateRequest(
                        new TemporalKey(key, time));

                final TemporalState state = db.getState(request);
                assertThat(state).isNotNull();
                final String val = state.val().toString();
                Objects.requireNonNull(val);
            };

            DurationTimer timer;

            LOGGER.info("Starting multi thread lookups");
            timer = DurationTimer.start();
            int totalKeyValueEntryCount = refStreamDefCount * keyValueMapCount * entryCount;
            IntStream.rangeClosed(0, totalKeyValueEntryCount)
                    .boxed()
                    .parallel()
                    .forEach(i -> work.run());

            LOGGER.info("Completed {} multi thread lookups in {}",
                    ModelStringUtil.formatCsv(totalKeyValueEntryCount),
                    timer);

            LOGGER.info("Starting single thread lookups");
            timer = DurationTimer.start();
            for (int i = 0; i < totalKeyValueEntryCount; i++) {
                work.run();
            }

            LOGGER.info("Completed {} single thread lookups in {}",
                    ModelStringUtil.formatCsv(totalKeyValueEntryCount),
                    timer);
        }
    }
This is meant to be compared to
stroom.pipeline.refdata.store.offheapstore.TestRefDataOffHeapStore#testLookupPerf()
stroom-state/stroom-planb-impl/src/test/java/stroom/planb/impl/db/TestStateLookupImpl.java