├── .github └── workflows │ └── maven.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── pom.xml ├── results ├── 20160630 │ ├── 1-forceSafe-reads.dat │ ├── 1-forceSafe-reads.png │ ├── 1-metaSync-writes.dat │ ├── 1-metaSync-writes.png │ ├── 1-sync-writes.dat │ ├── 1-sync-writes.png │ ├── 1-writeMap-writes.dat │ ├── 1-writeMap-writes.png │ ├── 2-size.dat │ ├── 2-size.png │ ├── 3-batchSize-writes.dat │ ├── 3-batchSize-writes.png │ ├── 4-intKey-rnd.dat │ ├── 4-intKey-rnd.png │ ├── 4-intKey-seq.dat │ ├── 4-intKey-seq.png │ ├── 4-size-biggest.dat │ ├── 4-size-biggest.png │ ├── 4-strKey-rnd.dat │ ├── 4-strKey-rnd.png │ ├── 4-strKey-seq.dat │ ├── 4-strKey-seq.png │ ├── 5-intKey-rnd.dat │ ├── 5-intKey-rnd.png │ ├── 5-intKey-seq.dat │ ├── 5-intKey-seq.png │ ├── 5-size.dat │ ├── 5-size.png │ ├── README.md │ ├── out-1.csv │ ├── out-1.tsv │ ├── out-1.txt │ ├── out-2.csv │ ├── out-2.tsv │ ├── out-2.txt │ ├── out-3.csv │ ├── out-3.tsv │ ├── out-3.txt │ ├── out-4.csv │ ├── out-4.tsv │ ├── out-4.txt │ ├── out-5.csv │ ├── out-5.tsv │ ├── out-5.txt │ └── plot ├── 20160710 │ ├── 1-forceSafe-reads.dat │ ├── 1-forceSafe-reads.png │ ├── 1-sync-writes.dat │ ├── 1-sync-writes.png │ ├── 1-writeMap-writes.dat │ ├── 1-writeMap-writes.png │ ├── 2-size.dat │ ├── 2-size.png │ ├── 3-batchSize-writes.dat │ ├── 3-batchSize-writes.png │ ├── 4-intKey-rnd-summary.png │ ├── 4-intKey-rnd.dat │ ├── 4-intKey-rnd.png │ ├── 4-intKey-seq-summary.png │ ├── 4-intKey-seq.dat │ ├── 4-intKey-seq.png │ ├── 4-size.dat │ ├── 4-size.md │ ├── 4-size.png │ ├── 4-strKey-rnd.dat │ ├── 4-strKey-rnd.png │ ├── 4-strKey-seq.dat │ ├── 4-strKey-seq.png │ ├── 5-intKey-rnd.dat │ ├── 5-intKey-rnd.png │ ├── 5-intKey-seq.dat │ ├── 5-intKey-seq.png │ ├── 5-size.dat │ ├── 5-size.md │ ├── 5-size.png │ ├── 6-intKey-rnd-16368.dat │ ├── 6-intKey-rnd-16368.png │ ├── 6-intKey-rnd-4080.dat │ ├── 6-intKey-rnd-4080.png │ ├── 6-intKey-rnd-8176.dat │ ├── 6-intKey-rnd-8176.png │ ├── 6-size-16368.dat │ ├── 6-size-16368.md │ ├── 6-size-16368.png │ ├── 6-size-4080.dat │ ├── 6-size-4080.md │ ├── 6-size-4080.png │ ├── 6-size-8176.dat │ ├── 6-size-8176.md │ ├── 6-size-8176.png │ ├── README.md │ ├── out-1.csv │ ├── out-1.tsv │ ├── out-1.txt │ ├── out-2.csv │ ├── out-2.tsv │ ├── out-2.txt │ ├── out-3.csv │ ├── out-3.tsv │ ├── out-3.txt │ ├── out-4.csv │ ├── out-4.tsv │ ├── out-4.txt │ ├── out-5.csv │ ├── out-5.tsv │ ├── out-5.txt │ ├── out-6.csv │ ├── out-6.tsv │ └── out-6.txt ├── process.sh └── run.sh └── src └── main └── java └── org └── lmdbjava └── bench ├── Chronicle.java ├── Common.java ├── CommonLmdbJava.java ├── LevelDb.java ├── LmdbJavaAgrona.java ├── LmdbJavaByteBuffer.java ├── LmdbJni.java ├── LmdbLwjgl.java ├── MapDb.java ├── MvStore.java ├── RocksDb.java ├── Xodus.java └── package-info.java /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | name: Maven Build 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | name: Java 11 Build and Verify 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Check out Git repository 16 | uses: actions/checkout@v3 17 | 18 | - name: Set up Java and Maven 19 | uses: actions/setup-java@v3 20 | with: 21 | distribution: zulu 22 | java-version: 11 23 | cache: maven 24 | 25 | - name: Setup HTTPS mirror proxy for Maven Central (due to Chroncile Map POM) 26 | uses: s4u/maven-settings-action@v2.8.0 27 | with: 28 | mirrors: '[{"id": "central-https-mirror", "name": "HTTPS Mirror of Maven Central", "mirrorOf": "central", "url": "https://repo1.maven.org/maven2"}]' 29 | 30 | - name: Build with Maven 31 | run: mvn -B verify 32 | 33 | - name: Simple benchmark test 34 | run: java -jar target/benchmarks.jar -foe true -wi 0 -i 1 -f 1 -p num=512 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | bin 3 | .classpath 4 | .project 5 | .settings 6 | .idea 7 | *.iml 8 | *~ 9 | *.properties 10 | *.releaseBackup 11 | *.log 12 | *.tag 13 | *.next 14 | *.jfr 15 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Please refer to the main LmdbJava project's 4 | [Contributing Guidelines](https://github.com/lmdbjava/lmdbjava/blob/master/CONTRIBUTING.md). 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Maven Build](https://github.com/lmdbjava/benchmarks/workflows/Maven%20Build/badge.svg)](https://github.com/lmdbjava/benchmarks/actions) 2 | [![License](https://img.shields.io/hexpm/l/plug.svg?maxAge=2592000)](http://www.apache.org/licenses/LICENSE-2.0.txt) 3 | 4 | # LmdbJava Benchmarks 5 | 6 | **Just want the latest results? 7 | [View them here!](https://github.com/lmdbjava/benchmarks/blob/master/results/20160710/README.md)** 8 | 9 | This is a [JMH](http://openjdk.java.net/projects/code-tools/jmh/) benchmark 10 | of open source, embedded, memory-mapped, key-value stores available from Java: 11 | 12 | * [LmdbJava](https://github.com/lmdbjava/lmdbjava) (with fast `ByteBuffer`, safe 13 | `ByteBuffer` and an [Agrona](https://github.com/real-logic/Agrona) buffer) 14 | * [LMDBJNI](https://github.com/deephacks/lmdbjni) 15 | * [Lightweight Java Game Library](https://github.com/LWJGL/lwjgl3/) (LMDB API) 16 | * [LevelDBJNI](https://github.com/fusesource/leveldbjni) 17 | * [RocksDB](http://rocksdb.org/) 18 | * [MVStore](http://h2database.com/html/mvstore.html) (pure Java) 19 | * [MapDB](http://www.mapdb.org/) (pure Java) 20 | * [Xodus](https://github.com/JetBrains/xodus) (pure Java) 21 | * [Chroncile Map](https://github.com/OpenHFT/Chronicle-Map) (pure Java) (**) 22 | 23 | (**) does not support ordered keys, so iteration benchmarks not performed 24 | 25 | The benchmark itself is adapted from LMDB's 26 | [db_bench_mdb.cc](http://lmdb.tech/bench/microbench/db_bench_mdb.cc), which in 27 | turn is adapted from 28 | [LevelDB's benchmark](https://github.com/google/leveldb/blob/master/db/db_bench.cc). 29 | 30 | The benchmark includes: 31 | 32 | * Writing data 33 | * Reading all data via each key 34 | * Reading all data via a reverse iterator 35 | * Reading all data via a forward iterator 36 | * Reading all data via a forward iterator and computing a CRC32 (via JDK API) 37 | * Reading all data via a forward iterator and computing a XXH64 38 | (via [extremely fast](https://github.com/benalexau/hash-bench) 39 | [Zero-Allocation-Hashing](https://github.com/OpenHFT/Zero-Allocation-Hashing)) 40 | 41 | Byte arrays (`byte[]`) are always used for the keys and values, avoiding any 42 | serialization library overhead. For those libraries that support compression, 43 | it is disabled in the benchmark. In general any special library features that 44 | decrease latency (eg batch modes, disable auto-commit, disable journals, 45 | hint at expected data sizes etc) were used. While we have tried to be fair and 46 | consistent, some libraries offer non-obvious tuning settings or usage patterns 47 | that might further reduce their latency. We do not claim we have exhausted 48 | every tuning option every library exposes, but pull requests are most welcome. 49 | 50 | ## Usage 51 | This benchmark uses POSIX calls to accurately determine consumed disk space and 52 | only depends on Linux-specific native library wrappers where a range of such 53 | wrappers exists. Operation on non-Linux operating systems is unsupported. 54 | 55 | 1. Clone this repository and `mvn clean package` 56 | 2. Run the benchmark with `java -jar target/benchmarks.jar` 57 | 58 | The benchmark offers many parameters, but to reduce execution time they default 59 | to a fast, mechanically-sympathetic workload (ie integer keys, sequential IO) 60 | that should fit in RAM. A default execution takes around 15 minutes on 61 | server-grade hardware (ie 2 x Intel Xeon E5-2667 v3 CPUs, 512 GB RAM etc). 62 | 63 | You can append ``-h`` to the ``java -jar`` line for JMH help. For example, use: 64 | 65 | * ``-foe true`` to stop on any error (recommended) 66 | * ``-rf csv`` to emit a CSV results file (recommended) 67 | * ``-f 3`` to run three forks for smaller error ranges (recommended) 68 | * ``-lp`` to list all available parameters 69 | * ``-p intKey=true,false`` to test both integer and string-based keys 70 | 71 | The parameters (available from `-lp`) allow you to create workloads of different 72 | iteration counts (`num`), key sizes and layout (`intKey`), value sizes 73 | (`valSize`), mechanical sympathy (`sequential`, `valRandom`) and feature tuning 74 | (eg `forceSafe`, `writeMap` etc). 75 | 76 | ``System.out`` will display the actual on-disk usage of each implementation as 77 | ``"Bytes" \t longVal \t benchId`` lines. This is not the "apparent" size (given 78 | sparse files are typical), but the actual on-disk space used. The underlying 79 | storage location defaults to the temporary file system. To force an alternate 80 | location, invoke Java with `-Djava.io.tmpdir=/somewhere/you/like`. 81 | 82 | ## Support 83 | 84 | Please [open a GitHub issue](https://github.com/lmdbjava/benchmarks/issues) 85 | if you have any questions. 86 | 87 | ## Contributing 88 | 89 | Contributions are welcome! Please see the LmdbJava project's 90 | [Contributing Guidelines](https://github.com/lmdbjava/lmdbjava/blob/master/CONTRIBUTING.md). 91 | 92 | ## License 93 | 94 | This project is licensed under the 95 | [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). 96 | -------------------------------------------------------------------------------- /results/20160630/1-forceSafe-reads.dat: -------------------------------------------------------------------------------- 1 | # "Param: writeMap","Param: sync","Param: metaSync","Benchmark","Param: forceSafe","Score" 2 | true "readCrc.unsafe" 103.712905 3 | true "readCrc.safe" 135.154228 4 | true "readKey.unsafe" 111.427965 5 | true "readKey.safe" 139.568885 6 | true "readRev.unsafe" 35.131203 7 | true "readRev.safe" 56.964770 8 | true "readSeq.unsafe" 43.113414 9 | true "readSeq.safe" 62.230417 10 | true "readXxh64.unsafe" 76.555106 11 | true "readXxh64.safe" 97.808384 12 | -------------------------------------------------------------------------------- /results/20160630/1-forceSafe-reads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/1-forceSafe-reads.png -------------------------------------------------------------------------------- /results/20160630/1-metaSync-writes.dat: -------------------------------------------------------------------------------- 1 | # "Param: ap","Param: sync","Benchmark","Param: forceSafe","Param: metaSync","Score" 2 | true false "LMDB BB (!ms)" false 166.014253 3 | true false "LMDB BB (ms)" true 151.568384 4 | true false "LMDB DB (!ms)" false 156.415707 5 | true false "LMDB DB (ms)" true 161.959713 6 | true false "LMDB JNI (!ms)" false 148.171342 7 | true false "LMDB JNI (ms)" true 147.891426 8 | -------------------------------------------------------------------------------- /results/20160630/1-metaSync-writes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/1-metaSync-writes.png -------------------------------------------------------------------------------- /results/20160630/1-sync-writes.dat: -------------------------------------------------------------------------------- 1 | # "Param: ap","Param: metaSync","Benchmark","Param: forceSafe","Param: sync","Score" 2 | true false "LMDB BB (no sync)" false 166.014253 3 | true false "LMDB BB (sync)" true 161.851662 4 | true false "LMDB DB (no sync)" false 156.415707 5 | true false "LMDB DB (sync)" true 142.327002 6 | true false "LMDB JNI (no sync)" false 148.171342 7 | true false "LMDB JNI (sync)" true 158.151015 8 | -------------------------------------------------------------------------------- /results/20160630/1-sync-writes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/1-sync-writes.png -------------------------------------------------------------------------------- /results/20160630/1-writeMap-writes.dat: -------------------------------------------------------------------------------- 1 | # "Param: sync","Param: metaSync","Benchmark","Param: forceSafe","Param: ap","Score" 2 | false false "LMDB BB (!wm)" false 199.794506 3 | false false "LMDB BB (wm)" true 166.014253 4 | false false "LMDB DB (!wm)" false 205.300457 5 | false false "LMDB DB (wm)" true 156.415707 6 | false false "LMDB JNI (!wm)" false 206.148822 7 | false false "LMDB JNI (wm)" true 148.171342 8 | -------------------------------------------------------------------------------- /results/20160630/1-writeMap-writes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/1-writeMap-writes.png -------------------------------------------------------------------------------- /results/20160630/2-size.dat: -------------------------------------------------------------------------------- 1 | "LevelDB 2020" 2057568256 2 | "LevelDB 2025" 2059452416 3 | "LevelDB 2030" 2073862144 4 | "LMDB 2020" 2744344576 5 | "LMDB 2025" 2746888192 6 | "LMDB 2030" 4128514048 7 | "RocksDB 2020" 2066350080 8 | "RocksDB 2025" 2074247168 9 | "RocksDB 2030" 2078076928 10 | -------------------------------------------------------------------------------- /results/20160630/2-size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/2-size.png -------------------------------------------------------------------------------- /results/20160630/3-batchSize-writes.dat: -------------------------------------------------------------------------------- 1 | # "Benchmark","Param: batchSize","Score" 2 | 1000000 1616.649970 3 | 100000 6921.592018 4 | 10000 21759.958101 5 | -------------------------------------------------------------------------------- /results/20160630/3-batchSize-writes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/3-batchSize-writes.png -------------------------------------------------------------------------------- /results/20160630/4-intKey-rnd.dat: -------------------------------------------------------------------------------- 1 | # ,1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17,, 2 | true "readCrc.LevelDB" false 1427.228444 3 | true "readCrc.LMDB BB" false 131.337836 4 | true "readCrc.LMDB DB" false 127.854619 5 | true "readCrc.LMDB JNI" false 147.685376 6 | true "readCrc.MapDB" false 180.981305 7 | true "readCrc.MVStore" false 565.619371 8 | true "readCrc.RocksDB" false 544.289587 9 | true "readKey.Chronicle" false 683.147264 10 | true "readKey.LevelDB" false 3237.536654 11 | true "readKey.LMDB BB" false 721.420288 12 | true "readKey.LMDB DB" false 691.419364 13 | true "readKey.LMDB JNI" false 688.331890 14 | true "readKey.MapDB" false 10364.591218 15 | true "readKey.MVStore" false 8811.766670 16 | true "readKey.RocksDB" false 11602.376932 17 | true "readRev.LevelDB" false 12920.320455 18 | true "readRev.LMDB BB" false 61.818243 19 | true "readRev.LMDB DB" false 62.371359 20 | true "readRev.LMDB JNI" false 64.061666 21 | true "readRev.MapDB" false 115.818693 22 | true "readRev.MVStore" false 608.756622 23 | true "readRev.RocksDB" false 591.455118 24 | true "readSeq.LevelDB" false 1323.302912 25 | true "readSeq.LMDB BB" false 73.103327 26 | true "readSeq.LMDB DB" false 65.188013 27 | true "readSeq.LMDB JNI" false 69.294539 28 | true "readSeq.MapDB" false 108.022691 29 | true "readSeq.MVStore" false 473.038848 30 | true "readSeq.RocksDB" false 391.604300 31 | true "readXxh64.LevelDB" false 1375.498695 32 | true "readXxh64.LMDB BB" false 98.417323 33 | true "readXxh64.LMDB DB" false 94.039618 34 | true "readXxh64.LMDB JNI" false 94.270915 35 | true "readXxh64.MapDB" false 139.353012 36 | true "readXxh64.MVStore" false 507.892084 37 | true "readXxh64.RocksDB" false 492.488793 38 | true "write.Chronicle" false 1089.237447 39 | true "write.LevelDB" false 282.748518 40 | true "write.LMDB BB" false 840.473994 41 | true "write.LMDB DB" false 839.319552 42 | true "write.LMDB JNI" false 901.775360 43 | true "write.MapDB" false 8827.611819 44 | true "write.MVStore" false 1746.694599 45 | true "write.RocksDB" false 2085.268139 46 | -------------------------------------------------------------------------------- /results/20160630/4-intKey-rnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/4-intKey-rnd.png -------------------------------------------------------------------------------- /results/20160630/4-intKey-seq.dat: -------------------------------------------------------------------------------- 1 | # ,1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17,, 2 | true "readCrc.LevelDB" true 1446.335829 3 | true "readCrc.LMDB BB" true 94.762435 4 | true "readCrc.LMDB DB" true 149.236563 5 | true "readCrc.LMDB JNI" true 134.097733 6 | true "readCrc.MapDB" true 180.592010 7 | true "readCrc.MVStore" true 566.085404 8 | true "readCrc.RocksDB" true 596.115456 9 | true "readKey.Chronicle" true 640.854699 10 | true "readKey.LevelDB" true 2971.431367 11 | true "readKey.LMDB BB" true 103.244406 12 | true "readKey.LMDB DB" true 107.277964 13 | true "readKey.LMDB JNI" true 112.316368 14 | true "readKey.MapDB" true 9486.583580 15 | true "readKey.MVStore" true 7764.122738 16 | true "readKey.RocksDB" true 5194.412487 17 | true "readRev.LevelDB" true 11708.632633 18 | true "readRev.LMDB BB" true 33.428484 19 | true "readRev.LMDB DB" true 35.156913 20 | true "readRev.LMDB JNI" true 30.578502 21 | true "readRev.MapDB" true 118.835949 22 | true "readRev.MVStore" true 587.319068 23 | true "readRev.RocksDB" true 610.562503 24 | true "readSeq.LevelDB" true 1372.702492 25 | true "readSeq.LMDB BB" true 41.846083 26 | true "readSeq.LMDB DB" true 44.374837 27 | true "readSeq.LMDB JNI" true 42.433650 28 | true "readSeq.MapDB" true 115.734978 29 | true "readSeq.MVStore" true 482.170197 30 | true "readSeq.RocksDB" true 390.497470 31 | true "readXxh64.LevelDB" true 1431.422748 32 | true "readXxh64.LMDB BB" true 76.723699 33 | true "readXxh64.LMDB DB" true 68.624384 34 | true "readXxh64.LMDB JNI" true 63.240457 35 | true "readXxh64.MapDB" true 144.478514 36 | true "readXxh64.MVStore" true 528.831829 37 | true "readXxh64.RocksDB" true 500.957184 38 | true "write.Chronicle" true 907.018240 39 | true "write.LevelDB" true 302.332132 40 | true "write.LMDB BB" true 157.747493 41 | true "write.LMDB DB" true 145.384217 42 | true "write.LMDB JNI" true 144.808346 43 | true "write.MapDB" true 8959.033344 44 | true "write.MVStore" true 1274.136348 45 | true "write.RocksDB" true 1886.271716 46 | -------------------------------------------------------------------------------- /results/20160630/4-intKey-seq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/4-intKey-seq.png -------------------------------------------------------------------------------- /results/20160630/4-size-biggest.dat: -------------------------------------------------------------------------------- 1 | "Chronicle" 122544128 2 | "LevelDB" 126476288 3 | "LMDB BB" 172040192 4 | "LMDB DB" 171868160 5 | "LMDB JNI" 171913216 6 | "MapDB" 118489088 7 | "MVStore" 108933120 8 | "RocksDB" 115032064 9 | -------------------------------------------------------------------------------- /results/20160630/4-size-biggest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/4-size-biggest.png -------------------------------------------------------------------------------- /results/20160630/4-strKey-rnd.dat: -------------------------------------------------------------------------------- 1 | # ,1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17,, 2 | false "readCrc.LevelDB" false 1564.475392 3 | false "readCrc.LMDB BB" false 182.619043 4 | false "readCrc.LMDB DB" false 162.156058 5 | false "readCrc.LMDB JNI" false 173.969993 6 | false "readCrc.MapDB" false 214.576262 7 | false "readCrc.MVStore" false 690.603804 8 | false "readCrc.RocksDB" false 580.445070 9 | false "readKey.Chronicle" false 1825.221291 10 | false "readKey.LevelDB" false 4795.487573 11 | false "readKey.LMDB BB" false 2013.498937 12 | false "readKey.LMDB DB" false 1941.496718 13 | false "readKey.LMDB JNI" false 2009.304633 14 | false "readKey.MapDB" false 12266.009031 15 | false "readKey.MVStore" false 10703.863808 16 | false "readKey.RocksDB" false 15062.211698 17 | false "readRev.LevelDB" false 12267.873166 18 | false "readRev.LMDB BB" false 66.213975 19 | false "readRev.LMDB DB" false 59.792932 20 | false "readRev.LMDB JNI" false 65.162949 21 | false "readRev.MapDB" false 126.125757 22 | false "readRev.MVStore" false 697.943836 23 | false "readRev.RocksDB" false 638.932309 24 | false "readSeq.LevelDB" false 1389.246692 25 | false "readSeq.LMDB BB" false 75.113769 26 | false "readSeq.LMDB DB" false 69.329860 27 | false "readSeq.LMDB JNI" false 72.306176 28 | false "readSeq.MapDB" false 116.623335 29 | false "readSeq.MVStore" false 606.484708 30 | false "readSeq.RocksDB" false 398.051100 31 | false "readXxh64.LevelDB" false 1504.590052 32 | false "readXxh64.LMDB BB" false 106.232400 33 | false "readXxh64.LMDB DB" false 99.578848 34 | false "readXxh64.LMDB JNI" false 89.795555 35 | false "readXxh64.MapDB" false 144.693850 36 | false "readXxh64.MVStore" false 619.417145 37 | false "readXxh64.RocksDB" false 526.194502 38 | false "write.Chronicle" false 1969.458745 39 | false "write.LevelDB" false 1228.232021 40 | false "write.LMDB BB" false 2003.246194 41 | false "write.LMDB DB" false 2038.431744 42 | false "write.LMDB JNI" false 2091.326578 43 | false "write.MapDB" false 12172.802276 44 | false "write.MVStore" false 2855.388956 45 | false "write.RocksDB" false 3882.527403 46 | -------------------------------------------------------------------------------- /results/20160630/4-strKey-rnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/4-strKey-rnd.png -------------------------------------------------------------------------------- /results/20160630/4-strKey-seq.dat: -------------------------------------------------------------------------------- 1 | # ,1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17,, 2 | false "readCrc.LevelDB" true 1399.033401 3 | false "readCrc.LMDB BB" true 141.654136 4 | false "readCrc.LMDB DB" true 176.494406 5 | false "readCrc.LMDB JNI" true 149.887890 6 | false "readCrc.MapDB" true 207.857397 7 | false "readCrc.MVStore" true 740.702436 8 | false "readCrc.RocksDB" true 548.221747 9 | false "readKey.Chronicle" true 1823.124139 10 | false "readKey.LevelDB" true 2944.401408 11 | false "readKey.LMDB BB" true 1145.044992 12 | false "readKey.LMDB DB" true 1200.386503 13 | false "readKey.LMDB JNI" true 1217.280228 14 | false "readKey.MapDB" true 8869.554859 15 | false "readKey.MVStore" true 1810.774244 16 | false "readKey.RocksDB" true 2965.372928 17 | false "readRev.LevelDB" true 9106.300018 18 | false "readRev.LMDB BB" true 35.606576 19 | false "readRev.LMDB DB" true 37.617122 20 | false "readRev.LMDB JNI" true 30.069743 21 | false "readRev.MapDB" true 118.844621 22 | false "readRev.MVStore" true 712.973426 23 | false "readRev.RocksDB" true 571.532174 24 | false "readSeq.LevelDB" true 1323.302912 25 | false "readSeq.LMDB BB" true 46.695553 26 | false "readSeq.LMDB DB" true 45.714309 27 | false "readSeq.LMDB JNI" true 39.072145 28 | false "readSeq.MapDB" true 117.873050 29 | false "readSeq.MVStore" true 606.717724 30 | false "readSeq.RocksDB" true 361.894647 31 | false "readXxh64.LevelDB" true 1335.652807 32 | false "readXxh64.LMDB BB" true 73.359750 33 | false "readXxh64.LMDB DB" true 68.146124 34 | false "readXxh64.LMDB JNI" true 64.261943 35 | false "readXxh64.MapDB" true 156.051786 36 | false "readXxh64.MVStore" true 648.952036 37 | false "readXxh64.RocksDB" true 470.873539 38 | false "write.Chronicle" true 2018.858325 39 | false "write.LevelDB" true 1324.001963 40 | false "write.LMDB BB" true 1154.831701 41 | false "write.LMDB DB" true 1184.308338 42 | false "write.LMDB JNI" true 1118.481067 43 | false "write.MapDB" true 12258.552491 44 | false "write.MVStore" true 1718.266539 45 | false "write.RocksDB" true 3146.194034 46 | -------------------------------------------------------------------------------- /results/20160630/4-strKey-seq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/4-strKey-seq.png -------------------------------------------------------------------------------- /results/20160630/5-intKey-rnd.dat: -------------------------------------------------------------------------------- 1 | # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17,, 2 | "readKey.Chronicle" false 22091.849714 3 | "readKey.LevelDB" false 278030.532060 4 | "readKey.LMDB BB" false 10330.545244 5 | "readKey.LMDB DB" false 10041.527591 6 | "readKey.LMDB JNI" false 10657.417177 7 | "readKey.MapDB" false 260614.695787 8 | "readSeq.LevelDB" false 47919.234487 9 | "readSeq.LMDB BB" false 1815.732419 10 | "readSeq.LMDB DB" false 2464.246197 11 | "readSeq.LMDB JNI" false 1952.566035 12 | "readSeq.MapDB" false 6618.117928 13 | "write.Chronicle" false 24753.293547 14 | "write.LevelDB" false 17331.546197 15 | "write.LMDB BB" false 147939.917964 16 | "write.LMDB DB" false 148238.565455 17 | "write.LMDB JNI" false 149345.016964 18 | "write.MapDB" false 588966.314429 19 | -------------------------------------------------------------------------------- /results/20160630/5-intKey-rnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/5-intKey-rnd.png -------------------------------------------------------------------------------- /results/20160630/5-intKey-seq.dat: -------------------------------------------------------------------------------- 1 | # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17,, 2 | "readKey.Chronicle" true 22208.132964 3 | "readKey.LevelDB" true 175465.658998 4 | "readKey.LMDB BB" true 2258.627523 5 | "readKey.LMDB DB" true 2215.255937 6 | "readKey.LMDB JNI" true 2150.475549 7 | "readKey.MapDB" true 182014.685930 8 | "readSeq.LevelDB" true 48481.371028 9 | "readSeq.LMDB BB" true 1458.428858 10 | "readSeq.LMDB DB" true 1784.578719 11 | "readSeq.LMDB JNI" true 1061.651228 12 | "readSeq.MapDB" true 6135.661883 13 | "write.Chronicle" true 25122.598150 14 | "write.LevelDB" true 17272.351107 15 | "write.LMDB BB" true 25756.504699 16 | "write.LMDB DB" true 25668.570768 17 | "write.LMDB JNI" true 26021.905051 18 | "write.MapDB" true 604236.726144 19 | -------------------------------------------------------------------------------- /results/20160630/5-intKey-seq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/5-intKey-seq.png -------------------------------------------------------------------------------- /results/20160630/5-size.dat: -------------------------------------------------------------------------------- 1 | "Chronicle" 20576509952 2 | "LevelDB" 20592087040 3 | "LMDB DB" 27449520128 4 | "LMDB BB" 27438403584 5 | "LMDB JNI" 27447676928 6 | "MapDB" 20879245312 7 | -------------------------------------------------------------------------------- /results/20160630/5-size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/5-size.png -------------------------------------------------------------------------------- /results/20160630/out-1.csv: -------------------------------------------------------------------------------- 1 | "Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: forceSafe","Param: intKey","Param: metaSync","Param: num","Param: sequential","Param: sync","Param: valRandom","Param: valSize","Param: writeMap" 2 | "org.lmdbjava.bench.LmdbJavaAgrona.readCrc","sample",1,74,126.054068,11.073030,"ms/op",,true,,1000000,true,,false,100,true 3 | "org.lmdbjava.bench.LmdbJavaAgrona.readCrc","sample",1,67,142.819573,8.502487,"ms/op",,true,,1000000,true,,false,100,false 4 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","sample",1,89,105.290579,5.060746,"ms/op",,true,,1000000,true,,false,100,true 5 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","sample",1,93,101.293287,5.420109,"ms/op",,true,,1000000,true,,false,100,false 6 | "org.lmdbjava.bench.LmdbJavaAgrona.readRev","sample",1,265,34.461178,1.269171,"ms/op",,true,,1000000,true,,false,100,true 7 | "org.lmdbjava.bench.LmdbJavaAgrona.readRev","sample",1,273,33.627170,1.102945,"ms/op",,true,,1000000,true,,false,100,false 8 | "org.lmdbjava.bench.LmdbJavaAgrona.readSeq","sample",1,222,41.790418,1.651487,"ms/op",,true,,1000000,true,,false,100,true 9 | "org.lmdbjava.bench.LmdbJavaAgrona.readSeq","sample",1,221,41.555162,1.596308,"ms/op",,true,,1000000,true,,false,100,false 10 | "org.lmdbjava.bench.LmdbJavaAgrona.readXxh64","sample",1,132,71.049961,3.856345,"ms/op",,true,,1000000,true,,false,100,true 11 | "org.lmdbjava.bench.LmdbJavaAgrona.readXxh64","sample",1,127,73.425606,3.861908,"ms/op",,true,,1000000,true,,false,100,false 12 | "org.lmdbjava.bench.LmdbJavaAgrona.write","sample",1,58,152.737298,13.315701,"ms/op",,true,true,1000000,true,true,false,100,true 13 | "org.lmdbjava.bench.LmdbJavaAgrona.write","sample",1,43,215.994463,20.180896,"ms/op",,true,true,1000000,true,true,false,100,false 14 | "org.lmdbjava.bench.LmdbJavaAgrona.write","sample",1,55,161.959713,12.604797,"ms/op",,true,true,1000000,true,false,false,100,true 15 | "org.lmdbjava.bench.LmdbJavaAgrona.write","sample",1,48,188.612608,15.583888,"ms/op",,true,true,1000000,true,false,false,100,false 16 | "org.lmdbjava.bench.LmdbJavaAgrona.write","sample",1,61,142.327002,9.983305,"ms/op",,true,false,1000000,true,true,false,100,true 17 | "org.lmdbjava.bench.LmdbJavaAgrona.write","sample",1,47,196.708396,16.671342,"ms/op",,true,false,1000000,true,true,false,100,false 18 | "org.lmdbjava.bench.LmdbJavaAgrona.write","sample",1,56,156.415707,13.059689,"ms/op",,true,false,1000000,true,false,false,100,true 19 | "org.lmdbjava.bench.LmdbJavaAgrona.write","sample",1,44,205.300457,16.834152,"ms/op",,true,false,1000000,true,false,false,100,false 20 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readCrc","sample",1,69,135.154228,10.459148,"ms/op",true,true,,1000000,true,,false,100,true 21 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readCrc","sample",1,77,123.233214,8.100643,"ms/op",true,true,,1000000,true,,false,100,false 22 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readCrc","sample",1,90,103.712905,7.014880,"ms/op",false,true,,1000000,true,,false,100,true 23 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readCrc","sample",1,100,94.935450,5.446328,"ms/op",false,true,,1000000,true,,false,100,false 24 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readKey","sample",1,69,139.568885,9.331084,"ms/op",true,true,,1000000,true,,false,100,true 25 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readKey","sample",1,63,150.064957,10.406302,"ms/op",true,true,,1000000,true,,false,100,false 26 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readKey","sample",1,86,111.427965,6.206020,"ms/op",false,true,,1000000,true,,false,100,true 27 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readKey","sample",1,87,106.935167,7.236854,"ms/op",false,true,,1000000,true,,false,100,false 28 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readRev","sample",1,164,56.964770,2.614067,"ms/op",true,true,,1000000,true,,false,100,true 29 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readRev","sample",1,153,60.919781,3.546613,"ms/op",true,true,,1000000,true,,false,100,false 30 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readRev","sample",1,260,35.131203,1.294086,"ms/op",false,true,,1000000,true,,false,100,true 31 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readRev","sample",1,273,33.423120,0.907761,"ms/op",false,true,,1000000,true,,false,100,false 32 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readSeq","sample",1,148,62.230417,2.336044,"ms/op",true,true,,1000000,true,,false,100,true 33 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readSeq","sample",1,134,69.897078,3.631319,"ms/op",true,true,,1000000,true,,false,100,false 34 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readSeq","sample",1,212,43.113414,1.748817,"ms/op",false,true,,1000000,true,,false,100,true 35 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readSeq","sample",1,196,46.572356,1.690523,"ms/op",false,true,,1000000,true,,false,100,false 36 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readXxh64","sample",1,96,97.808384,5.964932,"ms/op",true,true,,1000000,true,,false,100,true 37 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readXxh64","sample",1,101,94.486041,6.753501,"ms/op",true,true,,1000000,true,,false,100,false 38 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readXxh64","sample",1,123,76.555106,4.676032,"ms/op",false,true,,1000000,true,,false,100,true 39 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readXxh64","sample",1,130,72.019023,4.138897,"ms/op",false,true,,1000000,true,,false,100,false 40 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","sample",1,55,160.286757,13.784552,"ms/op",,true,true,1000000,true,true,false,100,true 41 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","sample",1,47,193.345144,11.048103,"ms/op",,true,true,1000000,true,true,false,100,false 42 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","sample",1,56,151.568384,12.285796,"ms/op",,true,true,1000000,true,false,false,100,true 43 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","sample",1,44,204.764253,16.617865,"ms/op",,true,true,1000000,true,false,false,100,false 44 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","sample",1,53,161.851662,15.327705,"ms/op",,true,false,1000000,true,true,false,100,true 45 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","sample",1,42,214.552381,18.600555,"ms/op",,true,false,1000000,true,true,false,100,false 46 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","sample",1,51,166.014253,14.914768,"ms/op",,true,false,1000000,true,false,false,100,true 47 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","sample",1,45,199.794506,14.761533,"ms/op",,true,false,1000000,true,false,false,100,false 48 | "org.lmdbjava.bench.LmdbJni.readCrc","sample",1,66,142.578533,10.135689,"ms/op",,true,,1000000,true,,false,100,true 49 | "org.lmdbjava.bench.LmdbJni.readCrc","sample",1,97,97.976996,5.791940,"ms/op",,true,,1000000,true,,false,100,false 50 | "org.lmdbjava.bench.LmdbJni.readKey","sample",1,86,110.665919,7.268458,"ms/op",,true,,1000000,true,,false,100,true 51 | "org.lmdbjava.bench.LmdbJni.readKey","sample",1,86,111.738880,6.680802,"ms/op",,true,,1000000,true,,false,100,false 52 | "org.lmdbjava.bench.LmdbJni.readRev","sample",1,295,31.038627,1.224101,"ms/op",,true,,1000000,true,,false,100,true 53 | "org.lmdbjava.bench.LmdbJni.readRev","sample",1,327,27.976256,0.918797,"ms/op",,true,,1000000,true,,false,100,false 54 | "org.lmdbjava.bench.LmdbJni.readSeq","sample",1,198,46.410245,1.959057,"ms/op",,true,,1000000,true,,false,100,true 55 | "org.lmdbjava.bench.LmdbJni.readSeq","sample",1,204,44.671137,1.861328,"ms/op",,true,,1000000,true,,false,100,false 56 | "org.lmdbjava.bench.LmdbJni.readXxh64","sample",1,129,71.424587,4.402385,"ms/op",,true,,1000000,true,,false,100,true 57 | "org.lmdbjava.bench.LmdbJni.readXxh64","sample",1,143,65.012170,3.840028,"ms/op",,true,,1000000,true,,false,100,false 58 | "org.lmdbjava.bench.LmdbJni.write","sample",1,58,156.868326,16.061040,"ms/op",,true,true,1000000,true,true,false,100,true 59 | "org.lmdbjava.bench.LmdbJni.write","sample",1,49,188.770429,14.700496,"ms/op",,true,true,1000000,true,true,false,100,false 60 | "org.lmdbjava.bench.LmdbJni.write","sample",1,59,147.891426,11.179794,"ms/op",,true,true,1000000,true,false,false,100,true 61 | "org.lmdbjava.bench.LmdbJni.write","sample",1,46,204.557802,17.539919,"ms/op",,true,true,1000000,true,false,false,100,false 62 | "org.lmdbjava.bench.LmdbJni.write","sample",1,57,158.151015,11.509041,"ms/op",,true,false,1000000,true,true,false,100,true 63 | "org.lmdbjava.bench.LmdbJni.write","sample",1,41,213.596210,20.193908,"ms/op",,true,false,1000000,true,true,false,100,false 64 | "org.lmdbjava.bench.LmdbJni.write","sample",1,59,148.171342,10.832837,"ms/op",,true,false,1000000,true,false,false,100,true 65 | "org.lmdbjava.bench.LmdbJni.write","sample",1,43,206.148822,15.907539,"ms/op",,true,false,1000000,true,false,false,100,false 66 | -------------------------------------------------------------------------------- /results/20160630/out-1.tsv: -------------------------------------------------------------------------------- 1 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readCrc-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 2 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readCrc-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 3 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readCrc-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 4 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readCrc-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 5 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readCrc-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 6 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readCrc-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 7 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 8 | Bytes 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 9 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 10 | Bytes 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 11 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 12 | Bytes 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 13 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 14 | Bytes 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 15 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 16 | Bytes 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 17 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 18 | Bytes 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 19 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readRev-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 20 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readRev-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 21 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readRev-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 22 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readRev-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 23 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readRev-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 24 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readRev-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 25 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readSeq-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 26 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readSeq-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 27 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readSeq-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 28 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readSeq-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 29 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readSeq-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 30 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readSeq-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 31 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readXxh64-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 32 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readXxh64-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 33 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readXxh64-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 34 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readXxh64-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 35 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readXxh64-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 36 | Bytes 117452800 org.lmdbjava.bench.LMDB DB.readXxh64-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 37 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 38 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 39 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 40 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 41 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 42 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 43 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 44 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 45 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 46 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 47 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 48 | Bytes 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 49 | Bytes 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 50 | Bytes 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 51 | Bytes 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 52 | Bytes 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 53 | Bytes 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 54 | Bytes 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 55 | -------------------------------------------------------------------------------- /results/20160630/out-2.csv: -------------------------------------------------------------------------------- 1 | "Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: intKey","Param: num","Param: sequential","Param: valRandom","Param: valSize","Param: writeMap" 2 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,9325.411621,NaN,"ms/op",true,1000000,true,false,2020, 3 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,8274.088398,NaN,"ms/op",true,1000000,true,false,2025, 4 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,7718.048453,NaN,"ms/op",true,1000000,true,false,2030, 5 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,11846.364909,NaN,"ms/op",true,1000000,false,false,2020, 6 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,11534.645164,NaN,"ms/op",true,1000000,false,false,2025, 7 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,12305.560061,NaN,"ms/op",true,1000000,false,false,2030, 8 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,263.531104,NaN,"ms/op",true,1000000,true,false,2020,true 9 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,254.938147,NaN,"ms/op",true,1000000,true,false,2025,true 10 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,142.141006,NaN,"ms/op",true,1000000,true,false,2030,true 11 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,723.034280,NaN,"ms/op",true,1000000,false,false,2020,true 12 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,824.639648,NaN,"ms/op",true,1000000,false,false,2025,true 13 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,605.163306,NaN,"ms/op",true,1000000,false,false,2030,true 14 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,12722.492550,NaN,"ms/op",true,1000000,true,false,2020, 15 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,11724.176420,NaN,"ms/op",true,1000000,true,false,2025, 16 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,13754.486083,NaN,"ms/op",true,1000000,true,false,2030, 17 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,16343.776122,NaN,"ms/op",true,1000000,false,false,2020, 18 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,17454.623633,NaN,"ms/op",true,1000000,false,false,2025, 19 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,17017.105969,NaN,"ms/op",true,1000000,false,false,2030, 20 | -------------------------------------------------------------------------------- /results/20160630/out-2.tsv: -------------------------------------------------------------------------------- 1 | Bytes 2075201536 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2020 2 | Bytes 2081087488 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2025 3 | Bytes 2088501248 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2030 4 | Bytes 2057568256 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2020 5 | Bytes 2059452416 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2025 6 | Bytes 2073862144 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2030 7 | Bytes 2055106560 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2020-writeMap-true-compacted 8 | Bytes 2055118848 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2020-writeMap-true 9 | Bytes 2055106560 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2025-writeMap-true-compacted 10 | Bytes 2055118848 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2025-writeMap-true 11 | Bytes 4118237184 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2030-writeMap-true-compacted 12 | Bytes 4118249472 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2030-writeMap-true 13 | Bytes 2744332288 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2020-writeMap-true-compacted 14 | Bytes 2744344576 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2020-writeMap-true 15 | Bytes 2746875904 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2025-writeMap-true-compacted 16 | Bytes 2746888192 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2025-writeMap-true 17 | Bytes 4128501760 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2030-writeMap-true-compacted 18 | Bytes 4128514048 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2030-writeMap-true 19 | Bytes 2069790720 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2020 20 | Bytes 2073980928 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2025 21 | Bytes 2078236672 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-2030 22 | Bytes 2066350080 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2020 23 | Bytes 2074247168 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2025 24 | Bytes 2078076928 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-1000000-sequential-false-valRandom-false-valSize-2030 25 | -------------------------------------------------------------------------------- /results/20160630/out-3.csv: -------------------------------------------------------------------------------- 1 | "Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: batchSize","Param: intKey","Param: num","Param: sequential","Param: valRandom","Param: valSize" 2 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,21759.958101,NaN,"ms/op",10000,true,1000000,true,false,2025 3 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,6921.592018,NaN,"ms/op",100000,true,1000000,true,false,2025 4 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,1616.649970,NaN,"ms/op",1000000,true,1000000,true,false,2025 5 | -------------------------------------------------------------------------------- /results/20160630/out-3.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160630/out-3.tsv -------------------------------------------------------------------------------- /results/20160630/out-3.txt: -------------------------------------------------------------------------------- 1 | # JMH 1.12 (released 89 days ago) 2 | # VM version: JDK 1.8.0_92, VM 25.92-b14 3 | # VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java 4 | # VM options: 5 | # Warmup: 6 | # Measurement: 1 iterations, single-shot each 7 | # Timeout: 10 min per iteration 8 | # Threads: 1 thread 9 | # Benchmark mode: Single shot invocation time 10 | # Benchmark: org.lmdbjava.bench.LevelDb.write 11 | # Parameters: (batchSize = 10000, intKey = true, num = 1000000, sequential = true, valRandom = false, valSize = 2025) 12 | 13 | # Run progress: 0.00% complete, ETA 00:00:00 14 | # Fork: 1 of 1 15 | Iteration 1: 21759.958 ms/op 16 | 17 | 18 | 19 | # JMH 1.12 (released 89 days ago) 20 | # VM version: JDK 1.8.0_92, VM 25.92-b14 21 | # VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java 22 | # VM options: 23 | # Warmup: 24 | # Measurement: 1 iterations, single-shot each 25 | # Timeout: 10 min per iteration 26 | # Threads: 1 thread 27 | # Benchmark mode: Single shot invocation time 28 | # Benchmark: org.lmdbjava.bench.LevelDb.write 29 | # Parameters: (batchSize = 100000, intKey = true, num = 1000000, sequential = true, valRandom = false, valSize = 2025) 30 | 31 | # Run progress: 33.33% complete, ETA 00:00:45 32 | # Fork: 1 of 1 33 | Iteration 1: 6921.592 ms/op 34 | 35 | 36 | 37 | # JMH 1.12 (released 89 days ago) 38 | # VM version: JDK 1.8.0_92, VM 25.92-b14 39 | # VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java 40 | # VM options: 41 | # Warmup: 42 | # Measurement: 1 iterations, single-shot each 43 | # Timeout: 10 min per iteration 44 | # Threads: 1 thread 45 | # Benchmark mode: Single shot invocation time 46 | # Benchmark: org.lmdbjava.bench.LevelDb.write 47 | # Parameters: (batchSize = 1000000, intKey = true, num = 1000000, sequential = true, valRandom = false, valSize = 2025) 48 | 49 | # Run progress: 66.67% complete, ETA 00:00:15 50 | # Fork: 1 of 1 51 | Iteration 1: 1616.650 ms/op 52 | 53 | 54 | 55 | # Run complete. Total time: 00:00:32 56 | 57 | Benchmark (batchSize) (intKey) (num) (sequential) (valRandom) (valSize) Mode Cnt Score Error Units 58 | LevelDb.write 10000 true 1000000 true false 2025 ss 21759.958 ms/op 59 | LevelDb.write 100000 true 1000000 true false 2025 ss 6921.592 ms/op 60 | LevelDb.write 1000000 true 1000000 true false 2025 ss 1616.650 ms/op 61 | 62 | Benchmark result is saved to out-3.csv 63 | -------------------------------------------------------------------------------- /results/20160630/out-5.csv: -------------------------------------------------------------------------------- 1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 2 | "Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: batchSize","Param: forceSafe","Param: intKey","Param: metaSync","Param: num","Param: sequential","Param: sync","Param: valRandom","Param: valSize","Param: writeMap" 3 | "org.lmdbjava.bench.Chronicle.readKey","ss",1,1,22208.132964,NaN,"ms/op",,,true,,10000000,true,,false,2025, 4 | "org.lmdbjava.bench.Chronicle.readKey","ss",1,1,22091.849714,NaN,"ms/op",,,true,,10000000,false,,false,2025, 5 | "org.lmdbjava.bench.Chronicle.write","ss",1,1,25122.598150,NaN,"ms/op",,,true,,10000000,true,,false,2025, 6 | "org.lmdbjava.bench.Chronicle.write","ss",1,1,24753.293547,NaN,"ms/op",,,true,,10000000,false,,false,2025, 7 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,175465.658998,NaN,"ms/op",,,true,,10000000,true,,false,2025, 8 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,278030.532060,NaN,"ms/op",,,true,,10000000,false,,false,2025, 9 | "org.lmdbjava.bench.LevelDb.readSeq","ss",1,1,48481.371028,NaN,"ms/op",,,true,,10000000,true,,false,2025, 10 | "org.lmdbjava.bench.LevelDb.readSeq","ss",1,1,47919.234487,NaN,"ms/op",,,true,,10000000,false,,false,2025, 11 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,17272.351107,NaN,"ms/op",10000000,,true,,10000000,true,,false,2025, 12 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,17331.546197,NaN,"ms/op",10000000,,true,,10000000,false,,false,2025, 13 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,2215.255937,NaN,"ms/op",,,true,,10000000,true,,false,2025,true 14 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,10041.527591,NaN,"ms/op",,,true,,10000000,false,,false,2025,true 15 | "org.lmdbjava.bench.LmdbJavaAgrona.readSeq","ss",1,1,1784.578719,NaN,"ms/op",,,true,,10000000,true,,false,2025,true 16 | "org.lmdbjava.bench.LmdbJavaAgrona.readSeq","ss",1,1,2464.246197,NaN,"ms/op",,,true,,10000000,false,,false,2025,true 17 | "org.lmdbjava.bench.LmdbJavaAgrona.write","ss",1,1,25668.570768,NaN,"ms/op",,,true,false,10000000,true,false,false,2025,true 18 | "org.lmdbjava.bench.LmdbJavaAgrona.write","ss",1,1,148238.565455,NaN,"ms/op",,,true,false,10000000,false,false,false,2025,true 19 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readKey","ss",1,1,2258.627523,NaN,"ms/op",,false,true,,10000000,true,,false,2025,true 20 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readKey","ss",1,1,10330.545244,NaN,"ms/op",,false,true,,10000000,false,,false,2025,true 21 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readSeq","ss",1,1,1458.428858,NaN,"ms/op",,false,true,,10000000,true,,false,2025,true 22 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readSeq","ss",1,1,1815.732419,NaN,"ms/op",,false,true,,10000000,false,,false,2025,true 23 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","ss",1,1,25756.504699,NaN,"ms/op",,,true,false,10000000,true,false,false,2025,true 24 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","ss",1,1,147939.917964,NaN,"ms/op",,,true,false,10000000,false,false,false,2025,true 25 | "org.lmdbjava.bench.LmdbJni.readKey","ss",1,1,2150.475549,NaN,"ms/op",,,true,,10000000,true,,false,2025,true 26 | "org.lmdbjava.bench.LmdbJni.readKey","ss",1,1,10657.417177,NaN,"ms/op",,,true,,10000000,false,,false,2025,true 27 | "org.lmdbjava.bench.LmdbJni.readSeq","ss",1,1,1061.651228,NaN,"ms/op",,,true,,10000000,true,,false,2025,true 28 | "org.lmdbjava.bench.LmdbJni.readSeq","ss",1,1,1952.566035,NaN,"ms/op",,,true,,10000000,false,,false,2025,true 29 | "org.lmdbjava.bench.LmdbJni.write","ss",1,1,26021.905051,NaN,"ms/op",,,true,false,10000000,true,false,false,2025,true 30 | "org.lmdbjava.bench.LmdbJni.write","ss",1,1,149345.016964,NaN,"ms/op",,,true,false,10000000,false,false,false,2025,true 31 | "org.lmdbjava.bench.MapDb.readKey","ss",1,1,182014.685930,NaN,"ms/op",,,true,,10000000,true,,false,2025, 32 | "org.lmdbjava.bench.MapDb.readKey","ss",1,1,260614.695787,NaN,"ms/op",,,true,,10000000,false,,false,2025, 33 | "org.lmdbjava.bench.MapDb.readSeq","ss",1,1,6135.661883,NaN,"ms/op",,,true,,10000000,true,,false,2025, 34 | "org.lmdbjava.bench.MapDb.readSeq","ss",1,1,6618.117928,NaN,"ms/op",,,true,,10000000,false,,false,2025, 35 | "org.lmdbjava.bench.MapDb.write","ss",1,1,604236.726144,NaN,"ms/op",,,true,,10000000,true,,false,2025, 36 | "org.lmdbjava.bench.MapDb.write","ss",1,1,588966.314429,NaN,"ms/op",,,true,,10000000,false,,false,2025, 37 | -------------------------------------------------------------------------------- /results/20160630/out-5.tsv: -------------------------------------------------------------------------------- 1 | Bytes 20576374784 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2025 2 | Bytes 20576509952 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2025 3 | Bytes 20587405312 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2025 4 | Bytes 20592087040 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2025 5 | Bytes 20550885376 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2025-writeMap-true-compacted 6 | Bytes 20550897664 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2025-writeMap-true 7 | Bytes 27449507840 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2025-writeMap-true-compacted 8 | Bytes 27449520128 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2025-writeMap-true 9 | Bytes 20550885376 org.lmdbjava.bench.LMDB DB.readSeq-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2025-writeMap-true-compacted 10 | Bytes 27442216960 org.lmdbjava.bench.LMDB DB.readSeq-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2025-writeMap-true-compacted 11 | Bytes 20550897664 org.lmdbjava.bench.LMDB BB.readKey-SingleShotTime-forceSafe-false-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2025-writeMap-true 12 | Bytes 27438403584 org.lmdbjava.bench.LMDB BB.readKey-SingleShotTime-forceSafe-false-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2025-writeMap-true 13 | Bytes 20550897664 org.lmdbjava.bench.LMDB JNI.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2025-writeMap-true 14 | Bytes 27447676928 org.lmdbjava.bench.LMDB JNI.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2025-writeMap-true 15 | Bytes 35337011200 org.lmdbjava.bench.MapDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2025 16 | Bytes 20879245312 org.lmdbjava.bench.MapDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2025 17 | -------------------------------------------------------------------------------- /results/20160630/plot: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" = "-h" -o "$1" = "--help" -o "$1" = "--h" -o "$1" = "" -o "$2" = "" ]; then 4 | for 5 | Usage: plot FILE DIR 6 | Plots the FILE into the output DIR, including a summary README.md. 7 | 8 | Arguments: 9 | FILE Input CSV (usually jmh-result.csv) 10 | DIR To write output (existing files will be removed) 11 | 12 | EOF 13 | exit 1; 14 | fi 15 | 16 | set -e 17 | 18 | hash gplot.pl 2>/dev/null || { printf "gplot not found\n"; exit 1; } 19 | hash dos2unix 2>/dev/null || { printf "dos2unix not found\n"; exit 1; } 20 | hash grep 2>/dev/null || { printf "grep not found\n"; exit 1; } 21 | hash cut 2>/dev/null || { printf "cut not found\n"; exit 1; } 22 | hash uniq 2>/dev/null || { printf "uniq not found\n"; exit 1; } 23 | hash sed 2>/dev/null || { printf "sed not found\n"; exit 1; } 24 | hash tr 2>/dev/null || { printf "tr not found\n"; exit 1; } 25 | hash sort 2>/dev/null || { printf "sort not found\n"; exit 1; } 26 | hash head 2>/dev/null || { printf "head not found\n"; exit 1; } 27 | 28 | FILE=$1 29 | DIRECTORY=$2 30 | 31 | if [ ! -f "${FILE}" ]; then 32 | echo "Input file not found (use -h for help)" 33 | exit 1 34 | fi 35 | 36 | if [ ! -d "${DIRECTORY}" ]; then 37 | echo "Output directory must exist (use -h for help)" 38 | exit 1 39 | fi 40 | 41 | dos2unix -q ${FILE} 42 | 43 | BUFFERS=$(cut -d , -f 1 ${FILE} | sort | uniq | grep -v Benchmark | sed 's/au.com.acegi.hashbench.HashBench.with//g' | sed 's/\"//g' | tr '\n' ' ') 44 | ALGOS=$(cut -d , -f 8 ${FILE} | sort | uniq | grep -v Param | tr '\n' ' ') 45 | HASHES=$(cut -d , -f 8 ${FILE} | grep -v Param | cut -d '-' -f 1 | sort | uniq | tr '\n' ' ') 46 | IMPLS=$(cut -d , -f 8 ${FILE} | grep -v Param | sed 's/.*-\(.*\)/\1/g' | sort | uniq | tr '\n' ' ') 47 | LENGTHS=$(cut -d , -f 9 ${FILE} | sort -n | uniq | grep -v Param | tr '\n' ' ') 48 | 49 | rm -f ${DIRECTORY}/* 50 | cp ${FILE} ${DIRECTORY} 51 | 52 | # Extract buffer-specific, algorithm-specific performance 53 | for BUFFER in ${BUFFERS}; do 54 | for ALGO in ${ALGOS}; do 55 | OUTPUT=${DIRECTORY}/${BUFFER}-${ALGO}.dat 56 | grep "${BUFFER}.*,${ALGO}," ${FILE} | cut -d , -f 5,9 | sed -e 's/,/ /g' >> ${OUTPUT} 57 | done 58 | done 59 | 60 | # Plot algo-specific performance as length increases (all algos) 61 | for ALGO in ${ALGOS}; do 62 | PNG=${DIRECTORY}/${ALGO}.png 63 | OPTS="" 64 | COUNTER=1 65 | for BUFFER in ${BUFFERS}; do 66 | ((COUNTER++)) 67 | INPUT=${DIRECTORY}/${BUFFER}-${ALGO}.dat 68 | OPTS+="-name ${BUFFER} -using 2:1 ${INPUT} " 69 | done 70 | gplot.pl -outfile ${PNG} -type png -title "${ALGO} by Slice Length" -xlabel "Bytes" -ylabel "ns/hash" -set "xtics nomirror rotate by -270; set key top left" -style linespoints ${OPTS} 71 | done 72 | 73 | length_performance() { 74 | # length outputFile algoList 75 | for ALGO in $3; do 76 | echo -n "${ALGO}" >> $2 77 | for BUFFER in ${BUFFERS}; do 78 | INPUT=${DIRECTORY}/${BUFFER}-${ALGO}.dat 79 | SCORE=$(grep " ${1}$" ${INPUT} | cut -d ' ' -f 1) 80 | echo -n " ${SCORE}" >> $2 81 | done 82 | echo "" >> $2 83 | done 84 | sort -n -k 2 ${2} -o ${2} 85 | } 86 | 87 | # Extract length-specific performance (all algos) 88 | for LENGTH in ${LENGTHS}; do 89 | OUTPUT=${DIRECTORY}/${LENGTH}.dat 90 | length_performance ${LENGTH} ${OUTPUT} "${ALGOS}" 91 | done 92 | 93 | # Plot length-specific performance (all algos, fast only) 94 | for LENGTH in ${LENGTHS}; do 95 | FULL_INPUT=${DIRECTORY}/${LENGTH}.dat 96 | TOP=30 97 | INPUT=${DIRECTORY}/${LENGTH}-fastest.dat 98 | cat ${FULL_INPUT} | head -n ${TOP} > ${INPUT} 99 | PNG=${DIRECTORY}/${LENGTH}.png 100 | OPTS="" 101 | COUNTER=1 102 | for BUFFER in ${BUFFERS}; do 103 | ((COUNTER++)) 104 | OPTS+="-name ${BUFFER} -using (5*column(0)):${COUNTER}:xtic(1) ${INPUT} " 105 | done 106 | gplot.pl -outfile ${PNG} -type png -title "Hash of ${LENGTH} Byte Slice (Fastest ${TOP})" -xlabel "" -ylabel "ns/hash (log scale)" -set "logscale y; set xtics nomirror rotate by -270; set key top left" -pointsize 1 -style points ${OPTS} 107 | done 108 | 109 | # Extract length-specific performance by hash family 110 | for LENGTH in ${LENGTHS}; do 111 | for HASH in ${HASHES}; do 112 | OUTPUT=${DIRECTORY}/${LENGTH}-${HASH}.dat 113 | INCLUDE=$(echo "${ALGOS}" | tr ' ' '\n' | grep "^${HASH}-" | tr '\n' ' ') 114 | length_performance ${LENGTH} ${OUTPUT} "${INCLUDE}" 115 | done 116 | done 117 | 118 | # Plot length-specific performance by hash family 119 | for LENGTH in ${LENGTHS}; do 120 | for HASH in ${HASHES}; do 121 | INPUT=${DIRECTORY}/${LENGTH}-${HASH}.dat 122 | PNG=${DIRECTORY}/${LENGTH}-${HASH}.png 123 | OPTS="" 124 | COUNTER=1 125 | for BUFFER in ${BUFFERS}; do 126 | ((COUNTER++)) 127 | OPTS+="-name ${BUFFER} -using (5*column(0)):${COUNTER}:xtic(1) ${INPUT} " 128 | done 129 | gplot.pl -outfile ${PNG} -type png -title "${HASH} of ${LENGTH} Byte Slice" -xlabel "" -ylabel "ns/hash" -set "xtics nomirror rotate by -270; set key top left" -pointsize 1 -style points ${OPTS} 130 | done 131 | done 132 | 133 | md_table() { 134 | # table heading row 135 | echo -n "| $1 | " >> ${INDEX} 136 | for BUFFER in ${BUFFERS}; do 137 | echo -n " ${BUFFER} |" >> ${INDEX} 138 | done 139 | echo "" >> ${INDEX} 140 | # table heading separator row 141 | echo -n "| --- | " >> ${INDEX} 142 | for BUFFER in ${BUFFERS}; do 143 | echo -n "---: | " >> ${INDEX} 144 | done 145 | echo "" >> ${INDEX} 146 | } 147 | 148 | # Summary page 149 | INDEX=${DIRECTORY}/README.md 150 | echo "# Hash-Bench Results" >> ${INDEX} 151 | echo "## Contents" >> ${INDEX} 152 | echo "### Latency by Byte Slice Length" >> ${INDEX} 153 | # table heading row 154 | echo -n "| Hash | " >> ${INDEX} 155 | for LENGTH in ${LENGTHS}; do 156 | echo -n "${LENGTH} |" >> ${INDEX} 157 | done 158 | echo "" >> ${INDEX} 159 | # table heading separator row 160 | echo -n "| --- | " >> ${INDEX} 161 | for LENGTH in ${LENGTHS}; do 162 | echo -n ":---: | " >> ${INDEX} 163 | done 164 | echo "" >> ${INDEX} 165 | # table data rows 166 | echo -n "| All | " >> ${INDEX} 167 | for LENGTH in ${LENGTHS}; do 168 | echo -n "[*](#${LENGTH}-byte-slice-latency-all-hashes) | " >> ${INDEX} 169 | done 170 | echo "" >> ${INDEX} 171 | for HASH in ${HASHES}; do 172 | echo -n "| ${HASH} | " >> ${INDEX} 173 | for LENGTH in ${LENGTHS}; do 174 | echo -n "[*](#${LENGTH}-byte-slice-latency-${HASH}) | " >> ${INDEX} 175 | done 176 | echo "" >> ${INDEX} 177 | done 178 | echo "### Latency by Algorithm" >> ${INDEX} 179 | for ALGO in ${ALGOS}; do 180 | echo " * [${ALGO}](#${ALGO}-latency)" >> ${INDEX} 181 | done 182 | echo "" >> ${INDEX} 183 | echo "---" >> ${INDEX} 184 | 185 | latency_by_length() { 186 | # inputFile 187 | SORTED_ALGOS=$(grep -v '#' $1 | cut -f 1 -d ' ') 188 | for ALGO in $SORTED_ALGOS; do 189 | echo -n "| [${ALGO}](#${ALGO}-latency)" >> ${INDEX} 190 | for BUFFER in ${BUFFERS}; do 191 | SCORE=$(grep ".*${BUFFER}.*${ALGO},${LENGTH}$" ${FILE} | cut -d ',' -f 5) 192 | echo -n " | ${SCORE}" >> ${INDEX} 193 | done 194 | echo " |" >> ${INDEX} 195 | done 196 | echo "" >> ${INDEX} 197 | echo "---" >> ${INDEX} 198 | } 199 | 200 | # Summary page latency by byte slice 201 | for LENGTH in ${LENGTHS}; do 202 | ## all hashes 203 | echo "### ${LENGTH} Byte Slice Latency (All Hashes)" >> ${INDEX} 204 | echo "![plot](${LENGTH}.png)" >> ${INDEX} 205 | echo "" >> ${INDEX} 206 | md_table "Algorithm" 207 | latency_by_length ${DIRECTORY}/${LENGTH}.dat 208 | 209 | ## by hash 210 | for HASH in ${HASHES}; do 211 | echo "### ${LENGTH} Byte Slice Latency (${HASH})" >> ${INDEX} 212 | echo "![plot](${LENGTH}-${HASH}.png)" >> ${INDEX} 213 | echo "" >> ${INDEX} 214 | md_table "Algorithm" 215 | latency_by_length ${DIRECTORY}/${LENGTH}-${HASH}.dat 216 | done 217 | done 218 | 219 | # Summary page latency by algorithm 220 | for ALGO in ${ALGOS}; do 221 | echo "### ${ALGO} Latency" >> ${INDEX} 222 | echo "![plot](${ALGO}.png)" >> ${INDEX} 223 | echo "" >> ${INDEX} 224 | md_table "Length" 225 | for LENGTH in ${LENGTHS}; do 226 | echo -n "| [${LENGTH}](#${LENGTH}-byte-slice-latency-all-hashes)" >> ${INDEX} 227 | for BUFFER in ${BUFFERS}; do 228 | SCORE=$(grep ".*${BUFFER}.*${ALGO},${LENGTH}$" ${FILE} | cut -d ',' -f 5) 229 | echo -n " | ${SCORE}" >> ${INDEX} 230 | done 231 | echo " |" >> ${INDEX} 232 | done 233 | echo "" >> ${INDEX} 234 | echo "---" >> ${INDEX} 235 | done 236 | 237 | rm ${DIRECTORY}/*.dat 238 | 239 | echo "Generated from [JMH CSV](${FILE}) on $(date -Ru) by [Hash-Bench](https://github.com/benalexau/hash-bench)." >> ${INDEX} 240 | -------------------------------------------------------------------------------- /results/20160710/1-forceSafe-reads.dat: -------------------------------------------------------------------------------- 1 | # "Param: writeMap","Param: sync","Param: metaSync","Benchmark","Param: forceSafe","Score" 2 | true "readCrc.unsafe" 101.158302 3 | true "readCrc.safe" 127.579108 4 | true "readKey.unsafe" 113.386755 5 | true "readKey.safe" 149.501518 6 | true "readRev.unsafe" 35.140178 7 | true "readRev.safe" 63.163949 8 | true "readSeq.unsafe" 41.947230 9 | true "readSeq.safe" 70.068825 10 | true "readXxh64.unsafe" 73.089024 11 | true "readXxh64.safe" 102.307395 12 | -------------------------------------------------------------------------------- /results/20160710/1-forceSafe-reads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/1-forceSafe-reads.png -------------------------------------------------------------------------------- /results/20160710/1-sync-writes.dat: -------------------------------------------------------------------------------- 1 | # "Param: ap","Param: metaSync","Benchmark","Param: forceSafe","Param: sync","Score" 2 | true false "LMDB BB (no sync)" false 161.043017 3 | true false "LMDB BB (sync)" true 150.883866 4 | true false "LMDB DB (no sync)" false 141.295616 5 | true false "LMDB DB (sync)" true 161.890304 6 | true false "LMDB JGL (no sync)" false 148.613803 7 | true false "LMDB JGL (sync)" true 156.929976 8 | true false "LMDB JNI (no sync)" false 154.669403 9 | true false "LMDB JNI (sync)" true 160.558519 10 | -------------------------------------------------------------------------------- /results/20160710/1-sync-writes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/1-sync-writes.png -------------------------------------------------------------------------------- /results/20160710/1-writeMap-writes.dat: -------------------------------------------------------------------------------- 1 | # "Param: sync","Param: metaSync","Benchmark","Param: forceSafe","Param: ap","Score" 2 | false false "LMDB BB (!wm)" false 186.341585 3 | false false "LMDB BB (wm)" true 161.043017 4 | false false "LMDB DB (!wm)" false 182.939812 5 | false false "LMDB DB (wm)" true 141.295616 6 | false false "LMDB JGL (!wm)" false 171.169752 7 | false false "LMDB JGL (wm)" true 148.613803 8 | false false "LMDB JNI (!wm)" false 197.804032 9 | false false "LMDB JNI (wm)" true 154.669403 10 | -------------------------------------------------------------------------------- /results/20160710/1-writeMap-writes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/1-writeMap-writes.png -------------------------------------------------------------------------------- /results/20160710/2-size.dat: -------------------------------------------------------------------------------- 1 | 2034450432 "LevelDB 2026" 2 | 2035449856 "LevelDB 2027" 3 | 4088889344 "LevelDB 4080" 4 | 4089888768 "LevelDB 4081" 5 | 8185761792 "LevelDB 8176" 6 | 8186761216 "LevelDB 8177" 7 | 16379514880 "LevelDB 16368" 8 | 16380514304 "LevelDB 16369" 9 | 2745884672 "LMDB 2026" 10 | 4128489472 "LMDB 2027" 11 | 4128112640 "LMDB 4080" 12 | 8223862784 "LMDB 4081" 13 | 8224284672 "LMDB 8176" 14 | 12319891456 "LMDB 8177" 15 | 16416251904 "LMDB 16368" 16 | 20512190464 "LMDB 16369" 17 | 2034470912 "RocksDB 2026" 18 | 2035470336 "RocksDB 2027" 19 | 4088909824 "RocksDB 4080" 20 | 4089909248 "RocksDB 4081" 21 | 8185782272 "RocksDB 8176" 22 | 8186781696 "RocksDB 8177" 23 | 16379535360 "RocksDB 16368" 24 | 16380534784 "RocksDB 16369" 25 | -------------------------------------------------------------------------------- /results/20160710/2-size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/2-size.png -------------------------------------------------------------------------------- /results/20160710/3-batchSize-writes.dat: -------------------------------------------------------------------------------- 1 | # "Benchmark","Param: batchSize","Score" 2 | "LevelDB 10M" 231086.702068 3 | "LevelDB 1M" 255152.012240 4 | "RocksDB 10M" 224929.376926 5 | "RocksDB 1M" 181361.408052 6 | -------------------------------------------------------------------------------- /results/20160710/3-batchSize-writes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/3-batchSize-writes.png -------------------------------------------------------------------------------- /results/20160710/4-intKey-rnd-summary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/4-intKey-rnd-summary.png -------------------------------------------------------------------------------- /results/20160710/4-intKey-rnd.dat: -------------------------------------------------------------------------------- 1 | # "Param: intKey","Benchmark","Param: sequential","Score" 2 | true "readCrc.LevelDB" false 1383.887303 3 | true "readCrc.LMDB BB" false 120.100112 4 | true "readCrc.LMDB DB" false 167.241318 5 | true "readCrc.LMDB JGL" false 122.555681 6 | true "readCrc.LMDB JNI" false 129.329616 7 | true "readCrc.MapDB" false 190.707190 8 | true "readCrc.MVStore" false 581.464519 9 | true "readCrc.RocksDB" false 477.650199 10 | true "readCrc.Xodus" false 1383.887303 11 | true "readKey.Chronicle" false 634.504988 12 | true "readKey.LevelDB" false 2476.037461 13 | true "readKey.LMDB BB" false 634.796260 14 | true "readKey.LMDB DB" false 648.019968 15 | true "readKey.LMDB JGL" false 665.321472 16 | true "readKey.LMDB JNI" false 679.652011 17 | true "readKey.MapDB" false 9707.483591 18 | true "readKey.MVStore" false 8420.298297 19 | true "readKey.RocksDB" false 2067.558855 20 | true "readKey.Xodus" false 4978.172814 21 | true "readRev.LevelDB" false 6442.450944 22 | true "readRev.LMDB BB" false 72.386528 23 | true "readRev.LMDB DB" false 61.485438 24 | true "readRev.LMDB JGL" false 59.482742 25 | true "readRev.LMDB JNI" false 59.146874 26 | true "readRev.MapDB" false 106.558557 27 | true "readRev.MVStore" false 574.590521 28 | true "readRev.RocksDB" false 1103.673903 29 | true "readRev.Xodus" false 1272.039196 30 | true "readSeq.LevelDB" false 1232.659342 31 | true "readSeq.LMDB BB" false 66.459042 32 | true "readSeq.LMDB DB" false 67.849851 33 | true "readSeq.LMDB JGL" false 76.904059 34 | true "readSeq.LMDB JNI" false 65.363223 35 | true "readSeq.MapDB" false 107.378895 36 | true "readSeq.MVStore" false 485.381461 37 | true "readSeq.RocksDB" false 341.226925 38 | true "readSeq.Xodus" false 1275.184924 39 | true "readXxh64.LevelDB" false 1279.262720 40 | true "readXxh64.LMDB BB" false 100.574505 41 | true "readXxh64.LMDB DB" false 97.094315 42 | true "readXxh64.LMDB JGL" false 86.544797 43 | true "readXxh64.LMDB JNI" false 84.683045 44 | true "readXxh64.MapDB" false 140.493764 45 | true "readXxh64.MVStore" false 517.472256 46 | true "readXxh64.RocksDB" false 443.442790 47 | true "readXxh64.Xodus" false 1382.489202 48 | true "write.Chronicle" false 894.510226 49 | true "write.LevelDB" false 2089.462443 50 | true "write.LMDB BB" false 896.451820 51 | true "write.LMDB DB" false 807.075840 52 | true "write.LMDB JGL" false 827.654144 53 | true "write.LMDB JNI" false 859.757422 54 | true "write.MapDB" false 9304.830407 55 | true "write.MVStore" false 1675.391431 56 | true "write.RocksDB" false 1850.853148 57 | true "write.Xodus" false 13981.013333 58 | -------------------------------------------------------------------------------- /results/20160710/4-intKey-rnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/4-intKey-rnd.png -------------------------------------------------------------------------------- /results/20160710/4-intKey-seq-summary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/4-intKey-seq-summary.png -------------------------------------------------------------------------------- /results/20160710/4-intKey-seq.dat: -------------------------------------------------------------------------------- 1 | # "Param: intKey","Benchmark","Param: sequential","Score" 2 | true "readCrc.LevelDB" true 1379.226965 3 | true "readCrc.LMDB BB" true 103.874560 4 | true "readCrc.LMDB DB" true 147.741975 5 | true "readCrc.LMDB JGL" true 95.170068 6 | true "readCrc.LMDB JNI" true 95.412472 7 | true "readCrc.MapDB" true 192.242294 8 | true "readCrc.MVStore" true 583.241273 9 | true "readCrc.RocksDB" true 388.788679 10 | true "readCrc.Xodus" true 1224.037717 11 | true "readKey.Chronicle" true 613.912121 12 | true "readKey.LevelDB" true 2223.447154 13 | true "readKey.LMDB BB" true 108.204404 14 | true "readKey.LMDB DB" true 109.745815 15 | true "readKey.LMDB JGL" true 96.653563 16 | true "readKey.LMDB JNI" true 102.073745 17 | true "readKey.MapDB" true 9676.725362 18 | true "readKey.MVStore" true 7757.598265 19 | true "readKey.RocksDB" true 1814.036480 20 | true "readKey.Xodus" true 3486.398692 21 | true "readRev.LevelDB" true 6265.358108 22 | true "readRev.LMDB BB" true 36.473645 23 | true "readRev.LMDB DB" true 36.182089 24 | true "readRev.LMDB JGL" true 33.422288 25 | true "readRev.LMDB JNI" true 31.765276 26 | true "readRev.MapDB" true 117.102567 27 | true "readRev.MVStore" true 580.678087 28 | true "readRev.RocksDB" true 1006.955599 29 | true "readRev.Xodus" true 1174.871154 30 | true "readSeq.LevelDB" true 1272.272213 31 | true "readSeq.LMDB BB" true 46.572265 32 | true "readSeq.LMDB DB" true 43.376563 33 | true "readSeq.LMDB JGL" true 43.901594 34 | true "readSeq.LMDB JNI" true 36.628942 35 | true "readSeq.MapDB" true 96.878096 36 | true "readSeq.MVStore" true 479.330304 37 | true "readSeq.RocksDB" true 268.879084 38 | true "readSeq.Xodus" true 1105.008454 39 | true "readXxh64.LevelDB" true 1311.186034 40 | true "readXxh64.LMDB BB" true 68.739928 41 | true "readXxh64.LMDB DB" true 70.499129 42 | true "readXxh64.LMDB JGL" true 56.837107 43 | true "readXxh64.LMDB JNI" true 70.742860 44 | true "readXxh64.MapDB" true 132.574713 45 | true "readXxh64.MVStore" true 529.431016 46 | true "readXxh64.RocksDB" true 344.866816 47 | true "readXxh64.Xodus" true 1275.534450 48 | true "write.Chronicle" true 836.705394 49 | true "write.LevelDB" true 1962.701255 50 | true "write.LMDB BB" true 144.026987 51 | true "write.LMDB DB" true 165.403331 52 | true "write.LMDB JGL" true 142.733247 53 | true "write.LMDB JNI" true 160.927818 54 | true "write.MapDB" true 8876.079332 55 | true "write.MVStore" true 1328.662300 56 | true "write.RocksDB" true 1800.754517 57 | true "write.Xodus" true 674.205241 58 | -------------------------------------------------------------------------------- /results/20160710/4-intKey-seq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/4-intKey-seq.png -------------------------------------------------------------------------------- /results/20160710/4-size.dat: -------------------------------------------------------------------------------- 1 | 104000000 "(Flat Array)" 2 | 107036672 "LevelDB" 3 | 107057152 "RocksDB" 4 | 108937216 "MVStore" 5 | 116801536 "Chronicle" 6 | 118489088 "MapDB" 7 | 171601920 "LMDB DB" 8 | 171896832 "LMDB JNI" 9 | 172040192 "LMDB BB" 10 | 172314624 "LMDB BB" 11 | 473067520 "Xodus" 12 | -------------------------------------------------------------------------------- /results/20160710/4-size.md: -------------------------------------------------------------------------------- 1 | | Implementation | Bytes | Overhead % | 2 | | -------------- | ----: | ---------: | 3 | | (Flat Array) | 104000000 | | 4 | | LevelDB | 107036672 | 2.91 | 5 | | RocksDB | 107057152 | 2.93 | 6 | | MVStore | 108937216 | 4.74 | 7 | | Chronicle | 116801536 | 12.30 | 8 | | MapDB | 118489088 | 13.93 | 9 | | LMDB DB | 171601920 | 65.00 | 10 | | LMDB JNI | 171896832 | 65.28 | 11 | | LMDB BB | 172040192 | 65.42 | 12 | | LMDB BB | 172314624 | 65.68 | 13 | | Xodus | 473067520 | 354.87 | 14 | -------------------------------------------------------------------------------- /results/20160710/4-size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/4-size.png -------------------------------------------------------------------------------- /results/20160710/4-strKey-rnd.dat: -------------------------------------------------------------------------------- 1 | # "Param: intKey","Benchmark","Param: sequential","Score" 2 | false "readCrc.LevelDB" false 1521.134251 3 | false "readCrc.LMDB BB" false 172.317550 4 | false "readCrc.LMDB DB" false 164.701965 5 | false "readCrc.LMDB JGL" false 153.491554 6 | false "readCrc.LMDB JNI" false 177.930240 7 | false "readCrc.MapDB" false 227.858003 8 | false "readCrc.MVStore" false 705.924665 9 | false "readCrc.RocksDB" false 530.928981 10 | false "readCrc.Xodus" false 1715.470336 11 | false "readKey.Chronicle" false 942.589164 12 | false "readKey.LevelDB" false 3212.370830 13 | false "readKey.LMDB BB" false 1038.816177 14 | false "readKey.LMDB DB" false 1062.933425 15 | false "readKey.LMDB JGL" false 1011.208564 16 | false "readKey.LMDB JNI" false 1154.796749 17 | false "readKey.MapDB" false 11151.256235 18 | false "readKey.MVStore" false 9646.899200 19 | false "readKey.RocksDB" false 2341.586716 20 | false "readKey.Xodus" false 4928.773234 21 | false "readRev.LevelDB" false 6483.461916 22 | false "readRev.LMDB BB" false 63.825284 23 | false "readRev.LMDB DB" false 65.782341 24 | false "readRev.LMDB JGL" false 65.542461 25 | false "readRev.LMDB JNI" false 57.157846 26 | false "readRev.MapDB" false 119.834650 27 | false "readRev.MVStore" false 733.944946 28 | false "readRev.RocksDB" false 1090.402532 29 | false "readRev.Xodus" false 1271.573163 30 | false "readSeq.LevelDB" false 1270.408078 31 | false "readSeq.LMDB BB" false 81.325047 32 | false "readSeq.LMDB DB" false 75.032378 33 | false "readSeq.LMDB JGL" false 66.720797 34 | false "readSeq.LMDB JNI" false 69.869753 35 | false "readSeq.MapDB" false 113.742409 36 | false "readSeq.MVStore" false 592.678457 37 | false "readSeq.RocksDB" false 345.353579 38 | false "readSeq.Xodus" false 1329.594368 39 | false "readXxh64.LevelDB" false 1334.254706 40 | false "readXxh64.LMDB BB" false 112.667949 41 | false "readXxh64.LMDB DB" false 106.239011 42 | false "readXxh64.LMDB JGL" false 91.741492 43 | false "readXxh64.LMDB JNI" false 102.135007 44 | false "readXxh64.MapDB" false 159.403213 45 | false "readXxh64.MVStore" false 632.000057 46 | false "readXxh64.RocksDB" false 446.125397 47 | false "readXxh64.Xodus" false 1718.732572 48 | false "write.Chronicle" false 1186.988032 49 | false "write.LevelDB" false 2494.678812 50 | false "write.LMDB BB" false 1215.649109 51 | false "write.LMDB DB" false 1288.117362 52 | false "write.LMDB JGL" false 1167.181596 53 | false "write.LMDB JNI" false 1374.799644 54 | false "write.MapDB" false 11266.832612 55 | false "write.MVStore" false 2113.929216 56 | false "write.RocksDB" false 2086.200206 57 | false "write.Xodus" false 16128.496981 58 | -------------------------------------------------------------------------------- /results/20160710/4-strKey-rnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/4-strKey-rnd.png -------------------------------------------------------------------------------- /results/20160710/4-strKey-seq.dat: -------------------------------------------------------------------------------- 1 | # "Param: intKey","Benchmark","Param: sequential","Score" 2 | false "readCrc.LevelDB" true 1189.551218 3 | false "readCrc.LMDB BB" true 150.200056 4 | false "readCrc.LMDB DB" true 138.873633 5 | false "readCrc.LMDB JGL" true 134.823936 6 | false "readCrc.LMDB JNI" true 120.828723 7 | false "readCrc.MapDB" true 223.992903 8 | false "readCrc.MVStore" true 721.129017 9 | false "readCrc.RocksDB" true 320.280774 10 | false "readCrc.Xodus" true 1404.858823 11 | false "readKey.Chronicle" true 833.494558 12 | false "readKey.LevelDB" true 1371.537408 13 | false "readKey.LMDB BB" true 359.281911 14 | false "readKey.LMDB DB" true 361.444147 15 | false "readKey.LMDB JGL" true 280.394890 16 | false "readKey.LMDB JNI" true 382.807912 17 | false "readKey.MapDB" true 8309.382258 18 | false "readKey.MVStore" true 863.187763 19 | false "readKey.RocksDB" true 1154.365668 20 | false "readKey.Xodus" true 3686.327182 21 | false "readRev.LevelDB" true 6064.031516 22 | false "readRev.LMDB BB" true 38.473608 23 | false "readRev.LMDB DB" true 37.502170 24 | false "readRev.LMDB JGL" true 32.193692 25 | false "readRev.LMDB JNI" true 31.927989 26 | false "readRev.MapDB" true 117.490675 27 | false "readRev.MVStore" true 720.495074 28 | false "readRev.RocksDB" true 912.710510 29 | false "readRev.Xodus" true 1157.045362 30 | false "readSeq.LevelDB" true 1106.142822 31 | false "readSeq.LMDB BB" true 44.351092 32 | false "readSeq.LMDB DB" true 42.019349 33 | false "readSeq.LMDB JGL" true 46.896358 34 | false "readSeq.LMDB JNI" true 41.801195 35 | false "readSeq.MapDB" true 109.457313 36 | false "readSeq.MVStore" true 625.300821 37 | false "readSeq.RocksDB" true 141.776213 38 | false "readSeq.Xodus" true 1037.828096 39 | false "readXxh64.LevelDB" true 1211.338297 40 | false "readXxh64.LMDB BB" true 75.045647 41 | false "readXxh64.LMDB DB" true 73.444531 42 | false "readXxh64.LMDB JGL" true 66.002543 43 | false "readXxh64.LMDB JNI" true 67.081597 44 | false "readXxh64.MapDB" true 154.861568 45 | false "readXxh64.MVStore" true 632.407836 46 | false "readXxh64.RocksDB" true 235.211825 47 | false "readXxh64.Xodus" true 1426.762411 48 | false "write.Chronicle" true 1115.265434 49 | false "write.LevelDB" true 1188.619150 50 | false "write.LMDB BB" true 368.611913 51 | false "write.LMDB DB" true 387.740103 52 | false "write.LMDB JGL" true 293.107832 53 | false "write.LMDB JNI" true 385.157499 54 | false "write.MapDB" true 11361.903502 55 | false "write.MVStore" true 1107.772881 56 | false "write.RocksDB" true 784.334848 57 | false "write.Xodus" true 832.199258 58 | -------------------------------------------------------------------------------- /results/20160710/4-strKey-seq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/4-strKey-seq.png -------------------------------------------------------------------------------- /results/20160710/5-intKey-rnd.dat: -------------------------------------------------------------------------------- 1 | # "Benchmark","Param: sequential","Score" 2 | "readKey.Chronicle" false 15944.858487 3 | "readKey.LevelDB" false 83784.845359 4 | "readKey.LMDB BB" false 10123.843919 5 | "readKey.LMDB DB" false 10923.701172 6 | "readKey.LMDB JGL" false 10857.482575 7 | "readKey.LMDB JNI" false 10569.633563 8 | "readKey.MapDB" false 242916.735261 9 | "readKey.RocksDB" false 44790.249109 10 | "readKey.Xodus" false 1578955.497375 11 | "readSeq.LevelDB" false 32047.441805 12 | "readSeq.LMDB BB" false 2734.506263 13 | "readSeq.LMDB DB" false 2055.777231 14 | "readSeq.LMDB JGL" false 2006.324902 15 | "readSeq.LMDB JNI" false 2226.269781 16 | "readSeq.MapDB" false 6744.528031 17 | "readSeq.RocksDB" false 11506.663250 18 | "readSeq.Xodus" false 203338.677881 19 | "write.Chronicle" false 22410.744891 20 | "write.LevelDB" false 86412.087792 21 | "write.LMDB BB" false 147392.585506 22 | "write.LMDB DB" false 148642.874642 23 | "write.LMDB JGL" false 146170.699849 24 | "write.LMDB JNI" false 148822.840227 25 | "write.MapDB" false 581837.785494 26 | "write.RocksDB" false 59849.329291 27 | "write.Xodus" false 894982.569215 28 | -------------------------------------------------------------------------------- /results/20160710/5-intKey-rnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/5-intKey-rnd.png -------------------------------------------------------------------------------- /results/20160710/5-intKey-seq.dat: -------------------------------------------------------------------------------- 1 | # "Benchmark","Param: sequential","Score" 2 | "readKey.Chronicle" true 16523.528102 3 | "readKey.LevelDB" true 49869.425090 4 | "readKey.LMDB BB" true 1987.580195 5 | "readKey.LMDB DB" true 2403.363008 6 | "readKey.LMDB JGL" true 2250.531111 7 | "readKey.LMDB JNI" true 2273.394261 8 | "readKey.MapDB" true 186230.685366 9 | "readKey.RocksDB" true 32197.614787 10 | "readKey.Xodus" true 207935.145585 11 | "readSeq.LevelDB" true 29328.154338 12 | "readSeq.LMDB BB" true 1123.468714 13 | "readSeq.LMDB DB" true 1105.370495 14 | "readSeq.LMDB JGL" true 1167.037977 15 | "readSeq.LMDB JNI" true 1471.413937 16 | "readSeq.MapDB" true 7066.082785 17 | "readSeq.RocksDB" true 10338.269858 18 | "readSeq.Xodus" true 267189.031560 19 | "write.Chronicle" true 22411.678079 20 | "write.LevelDB" true 76553.127411 21 | "write.LMDB BB" true 24740.714825 22 | "write.LMDB DB" true 24936.534679 23 | "write.LMDB JGL" true 24639.718588 24 | "write.LMDB JNI" true 25729.905035 25 | "write.MapDB" true 626492.597834 26 | "write.RocksDB" true 53615.823116 27 | "write.Xodus" true 32443.517298 28 | -------------------------------------------------------------------------------- /results/20160710/5-intKey-seq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/5-intKey-seq.png -------------------------------------------------------------------------------- /results/20160710/5-size.dat: -------------------------------------------------------------------------------- 1 | 20300000000 "(Flat Array)" 2 | 20344360960 "LevelDB" 3 | 20344381440 "RocksDB" 4 | 20412694528 "Chronicle" 5 | 20901265408 "MapDB" 6 | 27439894528 "LMDB BB" 7 | 27441250304 "LMDB JGL" 8 | 27441627136 "LMDB DB" 9 | 27441889280 "LMDB JNI" 10 | 28929896448 "Xodus" 11 | -------------------------------------------------------------------------------- /results/20160710/5-size.md: -------------------------------------------------------------------------------- 1 | | Implementation | Bytes | Overhead % | 2 | | -------------- | ----: | ---------: | 3 | | (Flat Array) | 20300000000 | | 4 | | LevelDB | 20344360960 | .21 | 5 | | RocksDB | 20344381440 | .21 | 6 | | Chronicle | 20412694528 | .55 | 7 | | MapDB | 20901265408 | 2.96 | 8 | | LMDB BB | 27439894528 | 35.17 | 9 | | LMDB JGL | 27441250304 | 35.17 | 10 | | LMDB DB | 27441627136 | 35.18 | 11 | | LMDB JNI | 27441889280 | 35.18 | 12 | | Xodus | 28929896448 | 42.51 | 13 | -------------------------------------------------------------------------------- /results/20160710/5-size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/5-size.png -------------------------------------------------------------------------------- /results/20160710/6-intKey-rnd-16368.dat: -------------------------------------------------------------------------------- 1 | # "Benchmark","Param: valSize","Score" 2 | "readKey.Chronicle" 16368 81.327306 3 | "readKey.LevelDB" 16368 300.783249 4 | "readKey.LMDB DB" 16368 9.732950 5 | "readKey.RocksDB" 16368 159.347102 6 | "readSeq.LevelDB" 16368 234.602241 7 | "readSeq.LMDB DB" 16368 0.401286 8 | "readSeq.RocksDB" 16368 177.488269 9 | "write.Chronicle" 16368 126.187559 10 | "write.LevelDB" 16368 500.968081 11 | "write.LMDB DB" 16368 214.141143 12 | "write.RocksDB" 16368 358.466309 13 | -------------------------------------------------------------------------------- /results/20160710/6-intKey-rnd-16368.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/6-intKey-rnd-16368.png -------------------------------------------------------------------------------- /results/20160710/6-intKey-rnd-4080.dat: -------------------------------------------------------------------------------- 1 | # "Benchmark","Param: valSize","Score" 2 | "readKey.Chronicle" 4080 24.495107 3 | "readKey.LevelDB" 4080 102.697436 4 | "readKey.LMDB DB" 4080 9.723010 5 | "readKey.RocksDB" 4080 56.728076 6 | "readSeq.LevelDB" 4080 47.244228 7 | "readSeq.LMDB DB" 4080 0.464262 8 | "readSeq.RocksDB" 4080 20.060184 9 | "write.Chronicle" 4080 37.279194 10 | "write.LevelDB" 4080 147.699310 11 | "write.LMDB DB" 4080 159.566708 12 | "write.RocksDB" 4080 116.462751 13 | -------------------------------------------------------------------------------- /results/20160710/6-intKey-rnd-4080.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/6-intKey-rnd-4080.png -------------------------------------------------------------------------------- /results/20160710/6-intKey-rnd-8176.dat: -------------------------------------------------------------------------------- 1 | # "Benchmark","Param: valSize","Score" 2 | "readKey.Chronicle" 8176 44.020074 3 | "readKey.LevelDB" 8176 119.782946 4 | "readKey.LMDB DB" 8176 8.477007 5 | "readKey.RocksDB" 8176 85.054896 6 | "readSeq.LevelDB" 8176 71.537234 7 | "readSeq.LMDB DB" 8176 0.401279 8 | "readSeq.RocksDB" 8176 36.255563 9 | "write.Chronicle" 8176 66.666823 10 | "write.LevelDB" 8176 268.696625 11 | "write.LMDB DB" 8176 182.624212 12 | "write.RocksDB" 8176 192.249410 13 | -------------------------------------------------------------------------------- /results/20160710/6-intKey-rnd-8176.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/6-intKey-rnd-8176.png -------------------------------------------------------------------------------- /results/20160710/6-size-16368.dat: -------------------------------------------------------------------------------- 1 | 163720000000 "(Flat Array)" 2 | 163795005440 "LevelDB" 3 | 163795025920 "RocksDB" 4 | 163832737792 "Chronicle" 5 | 164160393216 "LMDB DB" 6 | -------------------------------------------------------------------------------- /results/20160710/6-size-16368.md: -------------------------------------------------------------------------------- 1 | | Implementation | Bytes | Overhead % | 2 | | -------------- | ----: | ---------: | 3 | | (Flat Array) | 163720000000 | | 4 | | LevelDB | 163795005440 | .04 | 5 | | RocksDB | 163795025920 | .04 | 6 | | Chronicle | 163832737792 | .06 | 7 | | LMDB DB | 164160393216 | .26 | 8 | -------------------------------------------------------------------------------- /results/20160710/6-size-16368.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/6-size-16368.png -------------------------------------------------------------------------------- /results/20160710/6-size-4080.dat: -------------------------------------------------------------------------------- 1 | 40840000000 "(Flat Array)" 2 | 40888750080 "LevelDB" 3 | 40888770560 "RocksDB" 4 | 40952766464 "Chronicle" 5 | 41279459328 "LMDB DB" 6 | -------------------------------------------------------------------------------- /results/20160710/6-size-4080.md: -------------------------------------------------------------------------------- 1 | | Implementation | Bytes | Overhead % | 2 | | -------------- | ----: | ---------: | 3 | | (Flat Array) | 40840000000 | | 4 | | LevelDB | 40888750080 | .11 | 5 | | RocksDB | 40888770560 | .11 | 6 | | Chronicle | 40952766464 | .27 | 7 | | LMDB DB | 41279459328 | 1.07 | 8 | -------------------------------------------------------------------------------- /results/20160710/6-size-4080.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/6-size-4080.png -------------------------------------------------------------------------------- /results/20160710/6-size-8176.dat: -------------------------------------------------------------------------------- 1 | 81800000000 "(Flat Array)" 2 | 81857499136 "LevelDB" 3 | 81857519616 "RocksDB" 4 | 81912651776 "Chronicle" 5 | 82241519616 "LMDB DB" 6 | -------------------------------------------------------------------------------- /results/20160710/6-size-8176.md: -------------------------------------------------------------------------------- 1 | | Implementation | Bytes | Overhead % | 2 | | -------------- | ----: | ---------: | 3 | | (Flat Array) | 81800000000 | | 4 | | LevelDB | 81857499136 | .07 | 5 | | RocksDB | 81857519616 | .07 | 6 | | Chronicle | 81912651776 | .13 | 7 | | LMDB DB | 82241519616 | .53 | 8 | -------------------------------------------------------------------------------- /results/20160710/6-size-8176.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/6-size-8176.png -------------------------------------------------------------------------------- /results/20160710/out-1.tsv: -------------------------------------------------------------------------------- 1 | Bytes compacted 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 2 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 3 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 4 | Bytes compacted 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 5 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 6 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 7 | Bytes compacted 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true-compacted 8 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 9 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 10 | Bytes compacted 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 11 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 12 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 13 | Bytes compacted 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 14 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 15 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 16 | Bytes compacted 117452800 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false-compacted 17 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 18 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB DB.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 19 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 20 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 21 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 22 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 23 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 24 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 25 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 26 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 27 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 28 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 29 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 30 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-true-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 31 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 32 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 33 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 34 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 35 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 36 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 37 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 38 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 39 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 40 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 41 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 42 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB BB.readKey-SampleTime-forceSafe-false-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 43 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 44 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 45 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 46 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 47 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 48 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 49 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 50 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 51 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 52 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 53 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 54 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JNI.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 55 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 56 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 57 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 58 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 59 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 60 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-true 61 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 62 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 63 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 64 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 65 | Bytes before-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 66 | Bytes after-close 117465088 org.lmdbjava.bench.LMDB JGL.readKey-SampleTime-intKey-true-num-1000000-sequential-true-valRandom-false-valSize-100-writeMap-false 67 | -------------------------------------------------------------------------------- /results/20160710/out-2.csv: -------------------------------------------------------------------------------- 1 | "Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: intKey","Param: num","Param: sequential","Param: valRandom","Param: valSize","Param: writeMap" 2 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,3320.687899,NaN,"ms/op",true,1000000,true,false,2026, 3 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,3669.349345,NaN,"ms/op",true,1000000,true,false,2027, 4 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,4523.491730,NaN,"ms/op",true,1000000,true,false,4080, 5 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,3929.781835,NaN,"ms/op",true,1000000,true,false,4081, 6 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,6573.930021,NaN,"ms/op",true,1000000,true,false,8176, 7 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,5878.060400,NaN,"ms/op",true,1000000,true,false,8177, 8 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,9736.486540,NaN,"ms/op",true,1000000,true,false,16368, 9 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,9610.884315,NaN,"ms/op",true,1000000,true,false,16369, 10 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,4522.562530,NaN,"ms/op",true,1000000,false,false,2026, 11 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,4819.166120,NaN,"ms/op",true,1000000,false,false,2027, 12 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,5809.034050,NaN,"ms/op",true,1000000,false,false,4080, 13 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,6592.090624,NaN,"ms/op",true,1000000,false,false,4081, 14 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,7635.727036,NaN,"ms/op",true,1000000,false,false,8176, 15 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,8279.328717,NaN,"ms/op",true,1000000,false,false,8177, 16 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,12528.411934,NaN,"ms/op",true,1000000,false,false,16368, 17 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,11947.648529,NaN,"ms/op",true,1000000,false,false,16369, 18 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,242.883157,NaN,"ms/op",true,1000000,true,false,2026,true 19 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,143.778437,NaN,"ms/op",true,1000000,true,false,2027,true 20 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,132.141514,NaN,"ms/op",true,1000000,true,false,4080,true 21 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,165.201382,NaN,"ms/op",true,1000000,true,false,4081,true 22 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,130.386125,NaN,"ms/op",true,1000000,true,false,8176,true 23 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,211.234800,NaN,"ms/op",true,1000000,true,false,8177,true 24 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,127.167760,NaN,"ms/op",true,1000000,true,false,16368,true 25 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,126.851704,NaN,"ms/op",true,1000000,true,false,16369,true 26 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,716.677743,NaN,"ms/op",true,1000000,false,false,2026,true 27 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,625.865228,NaN,"ms/op",true,1000000,false,false,2027,true 28 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,626.883095,NaN,"ms/op",true,1000000,false,false,4080,true 29 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,607.859919,NaN,"ms/op",true,1000000,false,false,4081,true 30 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,546.603167,NaN,"ms/op",true,1000000,false,false,8176,true 31 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,540.334108,NaN,"ms/op",true,1000000,false,false,8177,true 32 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,522.319208,NaN,"ms/op",true,1000000,false,false,16368,true 33 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,519.030086,NaN,"ms/op",true,1000000,false,false,16369,true 34 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,2121.159364,NaN,"ms/op",true,1000000,true,false,2026, 35 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,2032.891897,NaN,"ms/op",true,1000000,true,false,2027, 36 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,2556.679372,NaN,"ms/op",true,1000000,true,false,4080, 37 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,2691.956912,NaN,"ms/op",true,1000000,true,false,4081, 38 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,3896.111318,NaN,"ms/op",true,1000000,true,false,8176, 39 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,3913.561830,NaN,"ms/op",true,1000000,true,false,8177, 40 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,5010.765698,NaN,"ms/op",true,1000000,true,false,16368, 41 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,5028.646976,NaN,"ms/op",true,1000000,true,false,16369, 42 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,2476.211609,NaN,"ms/op",true,1000000,false,false,2026, 43 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,3869.508923,NaN,"ms/op",true,1000000,false,false,2027, 44 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,3546.128410,NaN,"ms/op",true,1000000,false,false,4080, 45 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,3770.821505,NaN,"ms/op",true,1000000,false,false,4081, 46 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,5150.960611,NaN,"ms/op",true,1000000,false,false,8176, 47 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,4575.592445,NaN,"ms/op",true,1000000,false,false,8177, 48 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,6547.570991,NaN,"ms/op",true,1000000,false,false,16368, 49 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,5523.551611,NaN,"ms/op",true,1000000,false,false,16369, 50 | -------------------------------------------------------------------------------- /results/20160710/out-3.csv: -------------------------------------------------------------------------------- 1 | "Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: batchSize","Param: intKey","Param: num","Param: sequential","Param: valRandom","Param: valSize" 2 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,255152.012240,NaN,"ms/op",1000000,true,10000000,true,false,8176 3 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,231086.702068,NaN,"ms/op",10000000,true,10000000,true,false,8176 4 | "org.lmdbjava.bench.RocksDb.write","ss",1,1,181361.408052,NaN,"ms/op",1000000,true,10000000,true,false,8176 5 | "org.lmdbjava.bench.RocksDb.write","ss",1,1,224929.376926,NaN,"ms/op",10000000,true,10000000,true,false,8176 6 | -------------------------------------------------------------------------------- /results/20160710/out-3.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lmdbjava/benchmarks/dc46795e88efe3d57023b5e6e2b715bbf31c6633/results/20160710/out-3.tsv -------------------------------------------------------------------------------- /results/20160710/out-3.txt: -------------------------------------------------------------------------------- 1 | # JMH 1.12 (released 99 days ago, please consider updating!) 2 | # VM version: JDK 1.8.0_92, VM 25.92-b14 3 | # VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java 4 | # VM options: 5 | # Warmup: 6 | # Measurement: 1 iterations, single-shot each 7 | # Timeout: 60 min per iteration 8 | # Threads: 1 thread 9 | # Benchmark mode: Single shot invocation time 10 | # Benchmark: org.lmdbjava.bench.LevelDb.write 11 | # Parameters: (batchSize = 1000000, intKey = true, num = 10000000, sequential = true, valRandom = false, valSize = 8176) 12 | 13 | # Run progress: 0.00% complete, ETA 00:00:00 14 | # Fork: 1 of 1 15 | Iteration 1: 255152.012 ms/op 16 | 17 | 18 | 19 | # JMH 1.12 (released 99 days ago, please consider updating!) 20 | # VM version: JDK 1.8.0_92, VM 25.92-b14 21 | # VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java 22 | # VM options: 23 | # Warmup: 24 | # Measurement: 1 iterations, single-shot each 25 | # Timeout: 60 min per iteration 26 | # Threads: 1 thread 27 | # Benchmark mode: Single shot invocation time 28 | # Benchmark: org.lmdbjava.bench.LevelDb.write 29 | # Parameters: (batchSize = 10000000, intKey = true, num = 10000000, sequential = true, valRandom = false, valSize = 8176) 30 | 31 | # Run progress: 25.00% complete, ETA 00:13:06 32 | # Fork: 1 of 1 33 | Iteration 1: 231086.702 ms/op 34 | 35 | 36 | 37 | # JMH 1.12 (released 99 days ago, please consider updating!) 38 | # VM version: JDK 1.8.0_92, VM 25.92-b14 39 | # VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java 40 | # VM options: 41 | # Warmup: 42 | # Measurement: 1 iterations, single-shot each 43 | # Timeout: 60 min per iteration 44 | # Threads: 1 thread 45 | # Benchmark mode: Single shot invocation time 46 | # Benchmark: org.lmdbjava.bench.RocksDb.write 47 | # Parameters: (batchSize = 1000000, intKey = true, num = 10000000, sequential = true, valRandom = false, valSize = 8176) 48 | 49 | # Run progress: 50.00% complete, ETA 00:08:29 50 | # Fork: 1 of 1 51 | Iteration 1: 181361.408 ms/op 52 | 53 | 54 | 55 | # JMH 1.12 (released 99 days ago, please consider updating!) 56 | # VM version: JDK 1.8.0_92, VM 25.92-b14 57 | # VM invoker: /usr/lib/jvm/java-8-openjdk/jre/bin/java 58 | # VM options: 59 | # Warmup: 60 | # Measurement: 1 iterations, single-shot each 61 | # Timeout: 60 min per iteration 62 | # Threads: 1 thread 63 | # Benchmark mode: Single shot invocation time 64 | # Benchmark: org.lmdbjava.bench.RocksDb.write 65 | # Parameters: (batchSize = 10000000, intKey = true, num = 10000000, sequential = true, valRandom = false, valSize = 8176) 66 | 67 | # Run progress: 75.00% complete, ETA 00:03:53 68 | # Fork: 1 of 1 69 | Iteration 1: 224929.377 ms/op 70 | 71 | 72 | 73 | # Run complete. Total time: 00:15:33 74 | 75 | Benchmark (batchSize) (intKey) (num) (sequential) (valRandom) (valSize) Mode Cnt Score Error Units 76 | LevelDb.write 1000000 true 10000000 true false 8176 ss 255152.012 ms/op 77 | LevelDb.write 10000000 true 10000000 true false 8176 ss 231086.702 ms/op 78 | RocksDb.write 1000000 true 10000000 true false 8176 ss 181361.408 ms/op 79 | RocksDb.write 10000000 true 10000000 true false 8176 ss 224929.377 ms/op 80 | 81 | Benchmark result is saved to out-3.csv 82 | -------------------------------------------------------------------------------- /results/20160710/out-5.csv: -------------------------------------------------------------------------------- 1 | "Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: batchSize","Param: forceSafe","Param: intKey","Param: metaSync","Param: num","Param: sequential","Param: sync","Param: valRandom","Param: valSize","Param: writeMap" 2 | "org.lmdbjava.bench.Chronicle.readKey","ss",1,1,16523.528102,NaN,"ms/op",,,true,,10000000,true,,false,2026, 3 | "org.lmdbjava.bench.Chronicle.readKey","ss",1,1,15944.858487,NaN,"ms/op",,,true,,10000000,false,,false,2026, 4 | "org.lmdbjava.bench.Chronicle.write","ss",1,1,22411.678079,NaN,"ms/op",,,true,,10000000,true,,false,2026, 5 | "org.lmdbjava.bench.Chronicle.write","ss",1,1,22410.744891,NaN,"ms/op",,,true,,10000000,false,,false,2026, 6 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,49869.425090,NaN,"ms/op",,,true,,10000000,true,,false,2026, 7 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,83784.845359,NaN,"ms/op",,,true,,10000000,false,,false,2026, 8 | "org.lmdbjava.bench.LevelDb.readSeq","ss",1,1,29328.154338,NaN,"ms/op",,,true,,10000000,true,,false,2026, 9 | "org.lmdbjava.bench.LevelDb.readSeq","ss",1,1,32047.441805,NaN,"ms/op",,,true,,10000000,false,,false,2026, 10 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,76553.127411,NaN,"ms/op",1000000,,true,,10000000,true,,false,2026, 11 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,86412.087792,NaN,"ms/op",1000000,,true,,10000000,false,,false,2026, 12 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,2403.363008,NaN,"ms/op",,,true,,10000000,true,,false,2026,true 13 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,10923.701172,NaN,"ms/op",,,true,,10000000,false,,false,2026,true 14 | "org.lmdbjava.bench.LmdbJavaAgrona.readSeq","ss",1,1,1105.370495,NaN,"ms/op",,,true,,10000000,true,,false,2026,true 15 | "org.lmdbjava.bench.LmdbJavaAgrona.readSeq","ss",1,1,2055.777231,NaN,"ms/op",,,true,,10000000,false,,false,2026,true 16 | "org.lmdbjava.bench.LmdbJavaAgrona.write","ss",1,1,24936.534679,NaN,"ms/op",,,true,false,10000000,true,false,false,2026,true 17 | "org.lmdbjava.bench.LmdbJavaAgrona.write","ss",1,1,148642.874642,NaN,"ms/op",,,true,false,10000000,false,false,false,2026,true 18 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readKey","ss",1,1,1987.580195,NaN,"ms/op",,false,true,,10000000,true,,false,2026,true 19 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readKey","ss",1,1,10123.843919,NaN,"ms/op",,false,true,,10000000,false,,false,2026,true 20 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readSeq","ss",1,1,1123.468714,NaN,"ms/op",,false,true,,10000000,true,,false,2026,true 21 | "org.lmdbjava.bench.LmdbJavaByteBuffer.readSeq","ss",1,1,2734.506263,NaN,"ms/op",,false,true,,10000000,false,,false,2026,true 22 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","ss",1,1,24740.714825,NaN,"ms/op",,,true,false,10000000,true,false,false,2026,true 23 | "org.lmdbjava.bench.LmdbJavaByteBuffer.write","ss",1,1,147392.585506,NaN,"ms/op",,,true,false,10000000,false,false,false,2026,true 24 | "org.lmdbjava.bench.LmdbJni.readKey","ss",1,1,2273.394261,NaN,"ms/op",,,true,,10000000,true,,false,2026,true 25 | "org.lmdbjava.bench.LmdbJni.readKey","ss",1,1,10569.633563,NaN,"ms/op",,,true,,10000000,false,,false,2026,true 26 | "org.lmdbjava.bench.LmdbJni.readSeq","ss",1,1,1471.413937,NaN,"ms/op",,,true,,10000000,true,,false,2026,true 27 | "org.lmdbjava.bench.LmdbJni.readSeq","ss",1,1,2226.269781,NaN,"ms/op",,,true,,10000000,false,,false,2026,true 28 | "org.lmdbjava.bench.LmdbJni.write","ss",1,1,25729.905035,NaN,"ms/op",,,true,false,10000000,true,false,false,2026,true 29 | "org.lmdbjava.bench.LmdbJni.write","ss",1,1,148822.840227,NaN,"ms/op",,,true,false,10000000,false,false,false,2026,true 30 | "org.lmdbjava.bench.LmdbLwjgl.readKey","ss",1,1,2250.531111,NaN,"ms/op",,,true,,10000000,true,,false,2026,true 31 | "org.lmdbjava.bench.LmdbLwjgl.readKey","ss",1,1,10857.482575,NaN,"ms/op",,,true,,10000000,false,,false,2026,true 32 | "org.lmdbjava.bench.LmdbLwjgl.readSeq","ss",1,1,1167.037977,NaN,"ms/op",,,true,,10000000,true,,false,2026,true 33 | "org.lmdbjava.bench.LmdbLwjgl.readSeq","ss",1,1,2006.324902,NaN,"ms/op",,,true,,10000000,false,,false,2026,true 34 | "org.lmdbjava.bench.LmdbLwjgl.write","ss",1,1,24639.718588,NaN,"ms/op",,,true,false,10000000,true,false,false,2026,true 35 | "org.lmdbjava.bench.LmdbLwjgl.write","ss",1,1,146170.699849,NaN,"ms/op",,,true,false,10000000,false,false,false,2026,true 36 | "org.lmdbjava.bench.MapDb.readKey","ss",1,1,186230.685366,NaN,"ms/op",,,true,,10000000,true,,false,2026, 37 | "org.lmdbjava.bench.MapDb.readKey","ss",1,1,242916.735261,NaN,"ms/op",,,true,,10000000,false,,false,2026, 38 | "org.lmdbjava.bench.MapDb.readSeq","ss",1,1,7066.082785,NaN,"ms/op",,,true,,10000000,true,,false,2026, 39 | "org.lmdbjava.bench.MapDb.readSeq","ss",1,1,6744.528031,NaN,"ms/op",,,true,,10000000,false,,false,2026, 40 | "org.lmdbjava.bench.MapDb.write","ss",1,1,626492.597834,NaN,"ms/op",,,true,,10000000,true,,false,2026, 41 | "org.lmdbjava.bench.MapDb.write","ss",1,1,581837.785494,NaN,"ms/op",,,true,,10000000,false,,false,2026, 42 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,32197.614787,NaN,"ms/op",,,true,,10000000,true,,false,2026, 43 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,44790.249109,NaN,"ms/op",,,true,,10000000,false,,false,2026, 44 | "org.lmdbjava.bench.RocksDb.readSeq","ss",1,1,10338.269858,NaN,"ms/op",,,true,,10000000,true,,false,2026, 45 | "org.lmdbjava.bench.RocksDb.readSeq","ss",1,1,11506.663250,NaN,"ms/op",,,true,,10000000,false,,false,2026, 46 | "org.lmdbjava.bench.RocksDb.write","ss",1,1,53615.823116,NaN,"ms/op",1000000,,true,,10000000,true,,false,2026, 47 | "org.lmdbjava.bench.RocksDb.write","ss",1,1,59849.329291,NaN,"ms/op",1000000,,true,,10000000,false,,false,2026, 48 | "org.lmdbjava.bench.Xodus.readKey","ss",1,1,207935.145585,NaN,"ms/op",,,true,,10000000,true,,false,2026, 49 | "org.lmdbjava.bench.Xodus.readKey","ss",1,1,1578955.497375,NaN,"ms/op",,,true,,10000000,false,,false,2026, 50 | "org.lmdbjava.bench.Xodus.readSeq","ss",1,1,267189.031560,NaN,"ms/op",,,true,,10000000,true,,false,2026, 51 | "org.lmdbjava.bench.Xodus.readSeq","ss",1,1,203338.677881,NaN,"ms/op",,,true,,10000000,false,,false,2026, 52 | "org.lmdbjava.bench.Xodus.write","ss",1,1,32443.517298,NaN,"ms/op",,,true,,10000000,true,,false,2026, 53 | "org.lmdbjava.bench.Xodus.write","ss",1,1,894982.569215,NaN,"ms/op",,,true,,10000000,false,,false,2026, 54 | -------------------------------------------------------------------------------- /results/20160710/out-5.tsv: -------------------------------------------------------------------------------- 1 | Bytes before-close 20412723200 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 2 | Bytes after-close 20412723200 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 3 | Bytes before-close 20412694528 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 4 | Bytes after-close 20412694528 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 5 | Bytes before-close 20344360960 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 6 | Bytes after-close 20344360960 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 7 | Bytes before-close 20344360960 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 8 | Bytes after-close 20344360960 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 9 | Bytes compacted 20550885376 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026-writeMap-true-compacted 10 | Bytes before-close 20550897664 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026-writeMap-true 11 | Bytes after-close 20550897664 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026-writeMap-true 12 | Bytes compacted 27441614848 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026-writeMap-true-compacted 13 | Bytes before-close 27441627136 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026-writeMap-true 14 | Bytes after-close 27441627136 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026-writeMap-true 15 | Bytes before-close 20550897664 org.lmdbjava.bench.LMDB BB.readKey-SingleShotTime-forceSafe-false-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026-writeMap-true 16 | Bytes after-close 20550897664 org.lmdbjava.bench.LMDB BB.readKey-SingleShotTime-forceSafe-false-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026-writeMap-true 17 | Bytes before-close 27439894528 org.lmdbjava.bench.LMDB BB.readKey-SingleShotTime-forceSafe-false-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026-writeMap-true 18 | Bytes after-close 27439894528 org.lmdbjava.bench.LMDB BB.readKey-SingleShotTime-forceSafe-false-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026-writeMap-true 19 | Bytes before-close 20550897664 org.lmdbjava.bench.LMDB JNI.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026-writeMap-true 20 | Bytes after-close 20550897664 org.lmdbjava.bench.LMDB JNI.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026-writeMap-true 21 | Bytes before-close 27441889280 org.lmdbjava.bench.LMDB JNI.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026-writeMap-true 22 | Bytes after-close 27441889280 org.lmdbjava.bench.LMDB JNI.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026-writeMap-true 23 | Bytes before-close 20550897664 org.lmdbjava.bench.LMDB JGL.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026-writeMap-true 24 | Bytes after-close 20550897664 org.lmdbjava.bench.LMDB JGL.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026-writeMap-true 25 | Bytes before-close 27441250304 org.lmdbjava.bench.LMDB JGL.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026-writeMap-true 26 | Bytes after-close 27441250304 org.lmdbjava.bench.LMDB JGL.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026-writeMap-true 27 | Bytes before-close 35345399808 org.lmdbjava.bench.MapDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 28 | Bytes after-close 35345399808 org.lmdbjava.bench.MapDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 29 | Bytes before-close 20901265408 org.lmdbjava.bench.MapDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 30 | Bytes after-close 20901265408 org.lmdbjava.bench.MapDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 31 | Bytes before-close 20344381440 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 32 | Bytes after-close 20344381440 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 33 | Bytes before-close 20344381440 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 34 | Bytes after-close 20344381440 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 35 | Bytes before-close 20420018176 org.lmdbjava.bench.Xodus.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 36 | Bytes after-close 20420059136 org.lmdbjava.bench.Xodus.readKey-SingleShotTime-intKey-true-num-10000000-sequential-true-valRandom-false-valSize-2026 37 | Bytes before-close 28929835008 org.lmdbjava.bench.Xodus.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 38 | Bytes after-close 28929896448 org.lmdbjava.bench.Xodus.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-2026 39 | -------------------------------------------------------------------------------- /results/20160710/out-6.csv: -------------------------------------------------------------------------------- 1 | "Benchmark","Mode","Threads","Samples","Score","Score Error (99.9%)","Unit","Param: batchSize","Param: intKey","Param: metaSync","Param: num","Param: sequential","Param: sync","Param: valRandom","Param: valSize","Param: writeMap" 2 | "org.lmdbjava.bench.Chronicle.readKey","ss",1,1,24.495107,NaN,"s/op",,true,,10000000,false,,false,4080, 3 | "org.lmdbjava.bench.Chronicle.readKey","ss",1,1,44.020074,NaN,"s/op",,true,,10000000,false,,false,8176, 4 | "org.lmdbjava.bench.Chronicle.readKey","ss",1,1,81.327306,NaN,"s/op",,true,,10000000,false,,false,16368, 5 | "org.lmdbjava.bench.Chronicle.write","ss",1,1,37.279194,NaN,"s/op",,true,,10000000,false,,false,4080, 6 | "org.lmdbjava.bench.Chronicle.write","ss",1,1,66.666823,NaN,"s/op",,true,,10000000,false,,false,8176, 7 | "org.lmdbjava.bench.Chronicle.write","ss",1,1,126.187559,NaN,"s/op",,true,,10000000,false,,false,16368, 8 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,102.697436,NaN,"s/op",,true,,10000000,false,,false,4080, 9 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,119.782946,NaN,"s/op",,true,,10000000,false,,false,8176, 10 | "org.lmdbjava.bench.LevelDb.readKey","ss",1,1,300.783249,NaN,"s/op",,true,,10000000,false,,false,16368, 11 | "org.lmdbjava.bench.LevelDb.readSeq","ss",1,1,47.244228,NaN,"s/op",,true,,10000000,false,,false,4080, 12 | "org.lmdbjava.bench.LevelDb.readSeq","ss",1,1,71.537234,NaN,"s/op",,true,,10000000,false,,false,8176, 13 | "org.lmdbjava.bench.LevelDb.readSeq","ss",1,1,234.602241,NaN,"s/op",,true,,10000000,false,,false,16368, 14 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,147.699310,NaN,"s/op",1000000,true,,10000000,false,,false,4080, 15 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,268.696625,NaN,"s/op",1000000,true,,10000000,false,,false,8176, 16 | "org.lmdbjava.bench.LevelDb.write","ss",1,1,500.968081,NaN,"s/op",1000000,true,,10000000,false,,false,16368, 17 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,9.723010,NaN,"s/op",,true,,10000000,false,,false,4080,true 18 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,8.477007,NaN,"s/op",,true,,10000000,false,,false,8176,true 19 | "org.lmdbjava.bench.LmdbJavaAgrona.readKey","ss",1,1,9.732950,NaN,"s/op",,true,,10000000,false,,false,16368,true 20 | "org.lmdbjava.bench.LmdbJavaAgrona.readSeq","ss",1,1,0.464262,NaN,"s/op",,true,,10000000,false,,false,4080,true 21 | "org.lmdbjava.bench.LmdbJavaAgrona.readSeq","ss",1,1,0.401279,NaN,"s/op",,true,,10000000,false,,false,8176,true 22 | "org.lmdbjava.bench.LmdbJavaAgrona.readSeq","ss",1,1,0.401286,NaN,"s/op",,true,,10000000,false,,false,16368,true 23 | "org.lmdbjava.bench.LmdbJavaAgrona.write","ss",1,1,159.566708,NaN,"s/op",,true,false,10000000,false,false,false,4080,true 24 | "org.lmdbjava.bench.LmdbJavaAgrona.write","ss",1,1,182.624212,NaN,"s/op",,true,false,10000000,false,false,false,8176,true 25 | "org.lmdbjava.bench.LmdbJavaAgrona.write","ss",1,1,214.141143,NaN,"s/op",,true,false,10000000,false,false,false,16368,true 26 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,56.728076,NaN,"s/op",,true,,10000000,false,,false,4080, 27 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,85.054896,NaN,"s/op",,true,,10000000,false,,false,8176, 28 | "org.lmdbjava.bench.RocksDb.readKey","ss",1,1,159.347102,NaN,"s/op",,true,,10000000,false,,false,16368, 29 | "org.lmdbjava.bench.RocksDb.readSeq","ss",1,1,20.060184,NaN,"s/op",,true,,10000000,false,,false,4080, 30 | "org.lmdbjava.bench.RocksDb.readSeq","ss",1,1,36.255563,NaN,"s/op",,true,,10000000,false,,false,8176, 31 | "org.lmdbjava.bench.RocksDb.readSeq","ss",1,1,177.488269,NaN,"s/op",,true,,10000000,false,,false,16368, 32 | "org.lmdbjava.bench.RocksDb.write","ss",1,1,116.462751,NaN,"s/op",1000000,true,,10000000,false,,false,4080, 33 | "org.lmdbjava.bench.RocksDb.write","ss",1,1,192.249410,NaN,"s/op",1000000,true,,10000000,false,,false,8176, 34 | "org.lmdbjava.bench.RocksDb.write","ss",1,1,358.466309,NaN,"s/op",1000000,true,,10000000,false,,false,16368, 35 | -------------------------------------------------------------------------------- /results/20160710/out-6.tsv: -------------------------------------------------------------------------------- 1 | Bytes before-close 40952766464 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-4080 2 | Bytes after-close 40952766464 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-4080 3 | Bytes before-close 81912651776 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-8176 4 | Bytes after-close 81912651776 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-8176 5 | Bytes before-close 163832737792 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-16368 6 | Bytes after-close 163832737792 org.lmdbjava.bench.Chronicle.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-16368 7 | Bytes before-close 40888750080 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-4080 8 | Bytes after-close 40888750080 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-4080 9 | Bytes before-close 81857499136 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-8176 10 | Bytes after-close 81857499136 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-8176 11 | Bytes before-close 163795005440 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-16368 12 | Bytes after-close 163795005440 org.lmdbjava.bench.LevelDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-16368 13 | Bytes compacted 41279447040 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-4080-writeMap-true-compacted 14 | Bytes before-close 41279459328 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-4080-writeMap-true 15 | Bytes after-close 41279459328 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-4080-writeMap-true 16 | Bytes before-close 82241519616 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-8176-writeMap-true 17 | Bytes after-close 82241519616 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-8176-writeMap-true 18 | Bytes before-close 164160393216 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-16368-writeMap-true 19 | Bytes after-close 164160393216 org.lmdbjava.bench.LMDB DB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-16368-writeMap-true 20 | Bytes before-close 40888770560 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-4080 21 | Bytes after-close 40888770560 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-4080 22 | Bytes before-close 81857519616 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-8176 23 | Bytes after-close 81857519616 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-8176 24 | Bytes before-close 163795025920 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-16368 25 | Bytes after-close 163795025920 org.lmdbjava.bench.RocksDB.readKey-SingleShotTime-intKey-true-num-10000000-sequential-false-valRandom-false-valSize-16368 26 | -------------------------------------------------------------------------------- /results/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # designed to run from benchmark root, then user copies txt files to a results/YYYYMMDDD dir 4 | 5 | # RAM-bounded tests of embedded KV stores 6 | 7 | rm -f out-?.csv out-?.tsv out-?.txt 8 | 9 | # Run 1 compares LMDB impls with 1M x 100 byte values and LMDB-specific configuration options (~ 1 GB w/o overhead) 10 | java -jar target/benchmarks.jar -rf csv -f 3 -wi 3 -i 3 -to 10m -tu ms -p sync=true,false -p forceSafe=true,false -p metaSync=true,false -p writeMap=true,false -rff out-1.csv LmdbJavaAgrona LmdbJavaByteBuffer LmdbJni LmdbLwjgl | tee out-1.txt 11 | 12 | # Run 2 single shot (no warm up) native libraries with 1M entries to find reasonable ~2/4/8/16 KB value sizes (with int keys) 13 | java -jar target/benchmarks.jar -rf csv -bm ss -wi 0 -i 1 -to 10m -tu ms -p sequential=true,false -p valSize=2026,2027,4080,4081,8176,8177,16368,16369 -e readCrc -e readRev -e readSeq -e readXxh64 -e write -rff out-2.csv LevelDb LmdbJavaAgrona RocksDb | tee out-2.txt 14 | 15 | # conclusion: optimal if valSize=2026||4080||8176||16368 (Howard Chu has advised record sizes (ie key + val) should increment in 4,096 bytes unit after 4,084, so 4084, 8180, 12276, 16372 etc -- this is what we are seeing above as the valSize is recSize - 4 byte keySize) 16 | 17 | # Run 3 single shot (no warm up) evaluates LevelDB/RocksDB batch size for 10M entries 18 | # /etc/security/limits.conf soft + hard nofile @ 1000000 + reboot 19 | java -jar target/benchmarks.jar -rf csv -bm ss -wi 0 -i 1 -to 60m -tu ms -p valSize=8176 -p batchSize=1000000,10000000 -p num=10000000 -e readCrc -e readKey -e readRev -e readSeq -e readXxh64 -rff out-3.csv LevelDb RocksDb | tee out-3.txt 20 | 21 | # conclusion: optimal if batchSize=1M (1M was faster for RocksDB, and barely different for LevelDB, so we will go with 1M as it seems a reasonable compromise) 22 | 23 | # Run 4 compares all libraries with 1M x 100 byte values and assorted key types / access patterns (~ 100 MB w/o overhead) 24 | java -jar target/benchmarks.jar -rf csv -f 3 -wi 3 -i 3 -to 60m -tu ms -p intKey=true,false -p sequential=true,false -rff out-4.csv | tee out-4.txt 25 | 26 | # Following tests exclude readCrc, readRev and readXxh64 to save execution time 27 | 28 | # Following tests exclude string keys to save execution time (integer keys are smaller and easy to index/bitmask etc) 29 | 30 | # Following tests exclude MvStore, as it gives "java.lang.OutOfMemoryError: Capacity: 2147483647" 31 | 32 | # Run 5 single shot (no warm up) with 10M x 2026 byte values (~19 GB w/o overhead) 33 | java -jar target/benchmarks.jar -rf csv -bm ss -wi 0 -i 1 -to 120m -tu ms -p sequential=true,false -p batchSize=1000000 -p num=10000000 -p valSize=2026 -e readCrc -e readRev -e readXxh64 -rff out-5.csv Chronicle LevelDb LmdbJavaAgrona LmdbJavaByteBuffer LmdbJni LmdbLwjgl RocksDb MapDb Xodus | tee out-5.txt 34 | 35 | # Following tests exclude MapDB as: 36 | # 1. valSize=8176 gives "Native memory allocation (mmap) failed to map 12288 bytes for committing reserved memory" with values of 8176 and above. Its performance on ~2 KB values above 37 | # 2. Slow execution time makes it difficult to run the benchmark in a reasonable period 38 | # 3. Including very large MapDB values in the graphs make the remaining data hard to read 39 | 40 | # Following tests exclude Xodus for MapDB reasons 2-3 above 41 | 42 | # Following tests also exclude LmdbJavaByteBuffer and LmdbJni, as they all perform so similarly anyway and it needlessly increases execution time 43 | 44 | # Following tests also exclude sequential access patterns in the interests of time, as we already know sequential is much faster 45 | 46 | # Following tests switch to measurement in seconds given run durations 47 | 48 | # Run 6 single shot (no warm up) with 10M x 4080/8176/16368 byte values (~38/76/152 GB w/o overhead) 49 | java -jar target/benchmarks.jar -rf csv -bm ss -wi 0 -i 1 -to 360m -tu s -p sequential=false -p batchSize=1000000 -p num=10000000 -p valSize=4080,8176,16368 -e readCrc -e readRev -e readXxh64 -rff out-6.csv Chronicle LevelDb LmdbJavaAgrona RocksDb | tee out-6.txt 50 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/Chronicle.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.nio.ByteOrder.LITTLE_ENDIAN; 24 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 25 | import static net.openhft.chronicle.map.ChronicleMap.of; 26 | import static org.openjdk.jmh.annotations.Level.Invocation; 27 | import static org.openjdk.jmh.annotations.Level.Trial; 28 | import static org.openjdk.jmh.annotations.Mode.SampleTime; 29 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 30 | 31 | import java.io.File; 32 | import java.io.IOException; 33 | 34 | import net.openhft.chronicle.map.ChronicleMap; 35 | import org.agrona.MutableDirectBuffer; 36 | import org.agrona.concurrent.UnsafeBuffer; 37 | import org.openjdk.jmh.annotations.Benchmark; 38 | import org.openjdk.jmh.annotations.BenchmarkMode; 39 | import org.openjdk.jmh.annotations.Fork; 40 | import org.openjdk.jmh.annotations.Measurement; 41 | import org.openjdk.jmh.annotations.OutputTimeUnit; 42 | import org.openjdk.jmh.annotations.Setup; 43 | import org.openjdk.jmh.annotations.State; 44 | import org.openjdk.jmh.annotations.TearDown; 45 | import org.openjdk.jmh.annotations.Warmup; 46 | import org.openjdk.jmh.infra.BenchmarkParams; 47 | import org.openjdk.jmh.infra.Blackhole; 48 | 49 | @OutputTimeUnit(MILLISECONDS) 50 | @Fork(1) 51 | @Warmup(iterations = 3) 52 | @Measurement(iterations = 3) 53 | @BenchmarkMode(SampleTime) 54 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension"}) 55 | public class Chronicle { 56 | 57 | // Chroncile Map does not provide ordered keys, so no CRC/XXH64/rev/prev test 58 | @Benchmark 59 | public void readKey(final Reader r, final Blackhole bh) { 60 | for (final int key : r.keys) { 61 | if (r.intKey) { 62 | r.wkb.putInt(0, key); 63 | } else { 64 | r.wkb.putStringWithoutLengthUtf8(0, r.padKey(key)); 65 | } 66 | bh.consume(r.map.getUsing(r.wkb.byteArray(), r.wvb.byteArray())); 67 | } 68 | } 69 | 70 | @Benchmark 71 | public void write(final Writer w, final Blackhole bh) { 72 | w.write(); 73 | } 74 | 75 | @State(value = Benchmark) 76 | @SuppressWarnings("checkstyle:visibilitymodifier") 77 | public static class CommonChroncileMap extends Common { 78 | 79 | ChronicleMap map; 80 | 81 | /** 82 | * Writable key buffer. Backed by a plain byte[] for Chroncile API ease. 83 | */ 84 | MutableDirectBuffer wkb; 85 | 86 | /** 87 | * Writable value buffer. Backed by a plain byte[] for Chroncile API ease. 88 | */ 89 | MutableDirectBuffer wvb; 90 | 91 | @Override 92 | public void setup(final BenchmarkParams b) throws IOException { 93 | super.setup(b); 94 | wkb = new UnsafeBuffer(new byte[keySize]); 95 | wvb = new UnsafeBuffer(new byte[valSize]); 96 | 97 | try { 98 | map = of(byte[].class, byte[].class) 99 | .constantKeySizeBySample(new byte[keySize]) 100 | .constantValueSizeBySample(new byte[valSize]) 101 | .entries(num) 102 | .createPersistedTo(new File(tmp, "chroncile.map")); 103 | } catch (final IOException ex) { 104 | throw new IllegalStateException(ex); 105 | } 106 | } 107 | 108 | @Override 109 | public void teardown() throws IOException { 110 | reportSpaceBeforeClose(); 111 | map.close(); 112 | super.teardown(); 113 | } 114 | 115 | void write() { 116 | final int rndByteMax = RND_MB.length - valSize; 117 | int rndByteOffset = 0; 118 | for (final int key : keys) { 119 | if (intKey) { 120 | wkb.putInt(0, key, LITTLE_ENDIAN); 121 | } else { 122 | wkb.putStringWithoutLengthUtf8(0, padKey(key)); 123 | } 124 | if (valRandom) { 125 | wvb.putBytes(0, RND_MB, rndByteOffset, valSize); 126 | rndByteOffset += valSize; 127 | if (rndByteOffset >= rndByteMax) { 128 | rndByteOffset = 0; 129 | } 130 | } else { 131 | wvb.putInt(0, key); 132 | } 133 | map.put(wkb.byteArray(), wvb.byteArray()); 134 | } 135 | } 136 | } 137 | 138 | @State(Benchmark) 139 | public static class Reader extends CommonChroncileMap { 140 | 141 | @Setup(Trial) 142 | @Override 143 | public void setup(final BenchmarkParams b) throws IOException { 144 | super.setup(b); 145 | super.write(); 146 | } 147 | 148 | @TearDown(Trial) 149 | @Override 150 | public void teardown() throws IOException { 151 | super.teardown(); 152 | } 153 | } 154 | 155 | @SuppressWarnings("checkstyle:javadoctype") 156 | @State(Benchmark) 157 | public static class Writer extends CommonChroncileMap { 158 | 159 | @Setup(Invocation) 160 | @Override 161 | public final void setup(final BenchmarkParams b) throws IOException { 162 | super.setup(b); 163 | } 164 | 165 | @TearDown(Invocation) 166 | @Override 167 | public final void teardown() throws IOException { 168 | super.teardown(); 169 | } 170 | } 171 | 172 | } 173 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/Common.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.lang.Integer.BYTES; 24 | import static java.lang.System.getProperty; 25 | import static java.lang.System.out; 26 | import static jnr.posix.POSIXFactory.getPOSIX; 27 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 28 | 29 | import java.io.File; 30 | import java.io.IOException; 31 | import java.util.zip.CRC32; 32 | 33 | import jnr.posix.FileStat; 34 | import jnr.posix.POSIX; 35 | import org.agrona.collections.IntHashSet; 36 | import org.apache.commons.math3.random.BitsStreamGenerator; 37 | import org.apache.commons.math3.random.MersenneTwister; 38 | import org.openjdk.jmh.annotations.Param; 39 | import org.openjdk.jmh.annotations.State; 40 | import org.openjdk.jmh.infra.BenchmarkParams; 41 | 42 | /** 43 | * Common JMH {@link State} superclass for all DB benchmark states. 44 | * 45 | *

46 | * Members do not reflect the typical code standards of the LmdbJava project due 47 | * to compliance requirements with JMH {@link Param} and {@link State}. 48 | */ 49 | @State(Benchmark) 50 | @SuppressWarnings({"checkstyle:designforextension", 51 | "checkstyle:visibilitymodifier"}) 52 | public class Common { 53 | 54 | static final byte[] RND_MB = new byte[1_048_576]; 55 | static final int STRING_KEY_LENGTH = 16; 56 | private static final POSIX POSIX = getPOSIX(); 57 | private static final BitsStreamGenerator RND = new MersenneTwister(); 58 | private static final int S_BLKSIZE = 512; // from sys/stat.h 59 | private static final File TMP_BENCH; 60 | 61 | File compact; 62 | 63 | CRC32 crc; 64 | 65 | /** 66 | * Keys are always an integer, however they are actually stored as integers 67 | * (taking 4 bytes) or as zero-padded 16 byte strings. Storing keys as 68 | * integers offers a major performance gain. 69 | */ 70 | @Param("true") 71 | boolean intKey; 72 | 73 | /** 74 | * Determined during {@link #setup()} based on {@link #intKey} value. 75 | */ 76 | int keySize; 77 | /** 78 | * Keys in designated (random/sequential) order. 79 | */ 80 | int[] keys; 81 | 82 | /** 83 | * Number of entries to read/write to the database. 84 | */ 85 | @Param("1000000") 86 | int num; 87 | 88 | /** 89 | * Whether the keys are to be inserted into the database in sequential order 90 | * (and in the "readKeys" case, read back in that order). For LMDB, sequential 91 | * inserts use {@link org.lmdbjava.PutFlags#MDB_APPEND} and offer a major 92 | * performance gain. If this field is false, the append flag will not be used 93 | * and the keys will instead be inserted (and read back via "readKeys") in a 94 | * random order. 95 | */ 96 | @Param("true") 97 | boolean sequential; 98 | 99 | File tmp; 100 | 101 | /** 102 | * Whether the values contain random bytes or are simply the same as the key. 103 | * If true, the random bytes are obtained sequentially from a 1 MB random byte 104 | * buffer. 105 | */ 106 | @Param("false") 107 | boolean valRandom; 108 | 109 | /** 110 | * Number of bytes in each value. 111 | */ 112 | @Param("100") 113 | int valSize; 114 | 115 | static { 116 | RND.nextBytes(RND_MB); 117 | final String tmpParent = getProperty("java.io.tmpdir"); 118 | TMP_BENCH = new File(tmpParent, "lmdbjava-benchmark-scratch"); 119 | } 120 | 121 | public void setup(final BenchmarkParams b) throws IOException { 122 | keySize = intKey ? BYTES : STRING_KEY_LENGTH; 123 | crc = new CRC32(); 124 | final IntHashSet set = new IntHashSet(num); 125 | keys = new int[num]; 126 | for (int i = 0; i < num; i++) { 127 | if (sequential) { 128 | keys[i] = i; 129 | } else { 130 | while (true) { 131 | int candidateKey = RND.nextInt(); 132 | if (candidateKey < 0) { 133 | candidateKey *= -1; 134 | } 135 | if (!set.contains(candidateKey)) { 136 | set.add(candidateKey); 137 | keys[i] = candidateKey; 138 | break; 139 | } 140 | } 141 | } 142 | } 143 | 144 | rmdir(TMP_BENCH); 145 | tmp = create(b, ""); 146 | compact = create(b, "-compacted"); 147 | } 148 | 149 | public void reportSpaceBeforeClose() { 150 | if (tmp.getName().contains(".readKey-")) { 151 | reportSpaceUsed(tmp, "before-close"); 152 | } 153 | } 154 | 155 | public void teardown() throws IOException { 156 | // we only output for key, as all impls offer it and it should be fixed 157 | if (tmp.getName().contains(".readKey-")) { 158 | reportSpaceUsed(tmp, "after-close"); 159 | } 160 | rmdir(TMP_BENCH); 161 | } 162 | 163 | @SuppressWarnings("UseOfSystemOutOrSystemErr") 164 | protected void reportSpaceUsed(final File dir, final String desc) { 165 | final File[] files = dir.listFiles(); 166 | if (files == null) { 167 | return; 168 | } 169 | long bytes = 0; 170 | for (final File f : files) { 171 | if (f.isDirectory()) { 172 | throw new UnsupportedOperationException("impl created directory"); 173 | } 174 | final FileStat stat = POSIX.stat(f.getAbsolutePath()); 175 | bytes += stat.blocks() * S_BLKSIZE; 176 | } 177 | out.println("\nBytes\t" + desc + "\t" + bytes + "\t" + dir.getName()); 178 | } 179 | 180 | final String padKey(final int key) { 181 | final String skey = Integer.toString(key); 182 | return "0000000000000000".substring(0, 16 - skey.length()) + skey; 183 | } 184 | 185 | private File create(final BenchmarkParams b, final String suffix) { 186 | final File f = new File(TMP_BENCH, b.id() + suffix); 187 | if (!f.mkdirs()) { 188 | throw new IllegalStateException("Cannot mkdir " + f); 189 | } 190 | return f; 191 | } 192 | 193 | @SuppressWarnings("checkstyle:ReturnCount") 194 | private void rmdir(final File file) { 195 | if (!file.exists()) { 196 | return; 197 | } 198 | if (file.isDirectory()) { 199 | final File[] files = file.listFiles(); 200 | if (files == null) { 201 | return; 202 | } 203 | for (final File f : files) { 204 | rmdir(f); 205 | } 206 | } 207 | if (!file.delete()) { 208 | throw new IllegalStateException("Cannot delete " + file); 209 | } 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/CommonLmdbJava.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.lang.Boolean.TRUE; 24 | import static java.lang.System.setProperty; 25 | import static org.lmdbjava.DbiFlags.MDB_CREATE; 26 | import static org.lmdbjava.DbiFlags.MDB_INTEGERKEY; 27 | import static org.lmdbjava.Env.DISABLE_CHECKS_PROP; 28 | import static org.lmdbjava.Env.create; 29 | import static org.lmdbjava.EnvFlags.MDB_NOSYNC; 30 | import static org.lmdbjava.EnvFlags.MDB_WRITEMAP; 31 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 32 | 33 | import java.io.IOException; 34 | import java.util.HashSet; 35 | import java.util.Set; 36 | 37 | import org.lmdbjava.BufferProxy; 38 | import org.lmdbjava.Dbi; 39 | import org.lmdbjava.DbiFlags; 40 | import org.lmdbjava.Env; 41 | import org.lmdbjava.EnvFlags; 42 | import org.openjdk.jmh.annotations.Param; 43 | import org.openjdk.jmh.annotations.State; 44 | import org.openjdk.jmh.infra.BenchmarkParams; 45 | 46 | /** 47 | * Additional {@link State} members used by LmdbJava benchmarks. 48 | * 49 | * @param buffer type 50 | */ 51 | @State(Benchmark) 52 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension", 53 | "checkstyle:visibilitymodifier"}) 54 | public class CommonLmdbJava extends Common { 55 | 56 | static final int POSIX_MODE = 664; 57 | 58 | BufferProxy bufferProxy; 59 | Dbi db; 60 | Env env; 61 | 62 | /** 63 | * Whether {@link EnvFlags#MDB_WRITEMAP} is used. 64 | */ 65 | @Param("true") 66 | boolean writeMap; 67 | 68 | static { 69 | setProperty(DISABLE_CHECKS_PROP, TRUE.toString()); 70 | } 71 | 72 | static final DbiFlags[] dbiFlags(final boolean intKey) { 73 | final DbiFlags[] flags; 74 | if (intKey) { 75 | flags = new DbiFlags[]{MDB_CREATE, MDB_INTEGERKEY}; 76 | } else { 77 | flags = new DbiFlags[]{MDB_CREATE}; 78 | } 79 | return flags; 80 | } 81 | 82 | static final EnvFlags[] envFlags(final boolean writeMap, final boolean sync) { 83 | final Set envFlagSet = new HashSet<>(); 84 | if (writeMap) { 85 | envFlagSet.add(MDB_WRITEMAP); 86 | } 87 | if (!sync) { 88 | envFlagSet.add(MDB_NOSYNC); 89 | } 90 | final EnvFlags[] envFlags = new EnvFlags[envFlagSet.size()]; 91 | envFlagSet.toArray(envFlags); 92 | return envFlags; 93 | } 94 | 95 | static final long mapSize(final int num, final int valSize) { 96 | return num * ((long) valSize) * 32L / 10L; 97 | } 98 | 99 | public void setup(final BenchmarkParams b, final boolean sync) throws 100 | IOException { 101 | super.setup(b); 102 | final EnvFlags[] envFlags = envFlags(writeMap, sync); 103 | env = create(bufferProxy) 104 | .setMapSize(mapSize(num, valSize)) 105 | .setMaxDbs(1) 106 | .setMaxReaders(2) 107 | .open(tmp, POSIX_MODE, envFlags); 108 | 109 | final DbiFlags[] flags = dbiFlags(intKey); 110 | db = env.openDbi("db", flags); 111 | } 112 | 113 | @Override 114 | public void teardown() throws IOException { 115 | reportSpaceBeforeClose(); 116 | env.close(); 117 | super.teardown(); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/LevelDb.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.nio.ByteOrder.LITTLE_ENDIAN; 24 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 25 | import static net.openhft.hashing.LongHashFunction.xx_r39; 26 | import static org.fusesource.leveldbjni.JniDBFactory.factory; 27 | import static org.fusesource.leveldbjni.JniDBFactory.popMemoryPool; 28 | import static org.fusesource.leveldbjni.JniDBFactory.pushMemoryPool; 29 | import static org.iq80.leveldb.CompressionType.NONE; 30 | import static org.openjdk.jmh.annotations.Level.Invocation; 31 | import static org.openjdk.jmh.annotations.Level.Trial; 32 | import static org.openjdk.jmh.annotations.Mode.SampleTime; 33 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 34 | 35 | import java.io.IOException; 36 | import java.util.Map.Entry; 37 | 38 | import org.agrona.MutableDirectBuffer; 39 | import org.agrona.concurrent.UnsafeBuffer; 40 | import org.iq80.leveldb.DB; 41 | import org.iq80.leveldb.DBIterator; 42 | import org.iq80.leveldb.Options; 43 | import org.iq80.leveldb.WriteBatch; 44 | import org.openjdk.jmh.annotations.Benchmark; 45 | import org.openjdk.jmh.annotations.BenchmarkMode; 46 | import org.openjdk.jmh.annotations.Fork; 47 | import org.openjdk.jmh.annotations.Measurement; 48 | import org.openjdk.jmh.annotations.OutputTimeUnit; 49 | import org.openjdk.jmh.annotations.Param; 50 | import org.openjdk.jmh.annotations.Setup; 51 | import org.openjdk.jmh.annotations.State; 52 | import org.openjdk.jmh.annotations.TearDown; 53 | import org.openjdk.jmh.annotations.Warmup; 54 | import org.openjdk.jmh.infra.BenchmarkParams; 55 | import org.openjdk.jmh.infra.Blackhole; 56 | 57 | @OutputTimeUnit(MILLISECONDS) 58 | @Fork(1) 59 | @Warmup(iterations = 3) 60 | @Measurement(iterations = 3) 61 | @BenchmarkMode(SampleTime) 62 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension"}) 63 | public class LevelDb { 64 | 65 | @Benchmark 66 | public void readCrc(final Reader r, final Blackhole bh) throws IOException { 67 | r.crc.reset(); 68 | try (DBIterator iterator = r.db.iterator()) { 69 | for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) { 70 | final Entry peeked = iterator.peekNext(); 71 | r.crc.update(peeked.getKey()); 72 | r.crc.update(peeked.getValue()); 73 | } 74 | } 75 | bh.consume(r.crc.getValue()); 76 | } 77 | 78 | @Benchmark 79 | public void readKey(final Reader r, final Blackhole bh) throws IOException { 80 | for (final int key : r.keys) { 81 | if (r.intKey) { 82 | r.wkb.putInt(0, key); 83 | } else { 84 | r.wkb.putStringWithoutLengthUtf8(0, r.padKey(key)); 85 | } 86 | bh.consume(r.db.get(r.wkb.byteArray())); 87 | } 88 | } 89 | 90 | @Benchmark 91 | public void readRev(final Reader r, final Blackhole bh) throws IOException { 92 | try (DBIterator iterator = r.db.iterator()) { 93 | for (iterator.seekToLast(); iterator.hasPrev(); iterator.prev()) { 94 | final Entry peeked = iterator.peekPrev(); 95 | bh.consume(peeked.getValue()); 96 | } 97 | } 98 | } 99 | 100 | @Benchmark 101 | public void readSeq(final Reader r, final Blackhole bh) throws IOException { 102 | try (DBIterator iterator = r.db.iterator()) { 103 | for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) { 104 | final Entry peeked = iterator.peekNext(); 105 | bh.consume(peeked.getValue()); 106 | } 107 | } 108 | } 109 | 110 | @Benchmark 111 | public void readXxh64(final Reader r, final Blackhole bh) throws IOException { 112 | long result = 0; 113 | try (DBIterator iterator = r.db.iterator()) { 114 | for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) { 115 | final Entry peeked = iterator.peekNext(); 116 | result += xx_r39().hashBytes(peeked.getKey()); 117 | result += xx_r39().hashBytes(peeked.getValue()); 118 | } 119 | } 120 | bh.consume(result); 121 | } 122 | 123 | @Benchmark 124 | public void write(final Writer w, final Blackhole bh) throws IOException { 125 | w.write(w.batchSize); 126 | } 127 | 128 | @State(value = Benchmark) 129 | @SuppressWarnings("checkstyle:visibilitymodifier") 130 | public static class CommonLevelDb extends Common { 131 | 132 | DB db; 133 | 134 | /** 135 | * Writable key buffer. Backed by a plain byte[] for LevelDB API ease. 136 | */ 137 | MutableDirectBuffer wkb; 138 | 139 | /** 140 | * Writable value buffer. Backed by a plain byte[] for LevelDB API ease. 141 | */ 142 | MutableDirectBuffer wvb; 143 | 144 | @Override 145 | public void setup(final BenchmarkParams b) throws IOException { 146 | super.setup(b); 147 | wkb = new UnsafeBuffer(new byte[keySize]); 148 | wvb = new UnsafeBuffer(new byte[valSize]); 149 | pushMemoryPool(1_024 * 512); 150 | final Options options = new Options(); 151 | options.createIfMissing(true); 152 | options.compressionType(NONE); 153 | db = factory.open(tmp, options); 154 | } 155 | 156 | @Override 157 | public void teardown() throws IOException { 158 | reportSpaceBeforeClose(); 159 | db.close(); 160 | popMemoryPool(); 161 | super.teardown(); 162 | } 163 | 164 | @SuppressWarnings("PMD.CloseResource") 165 | void write(final int batchSize) throws IOException { 166 | final int rndByteMax = RND_MB.length - valSize; 167 | int rndByteOffset = 0; 168 | WriteBatch batch = db.createWriteBatch(); 169 | for (int i = 0; i < keys.length; i++) { 170 | final int key = keys[i]; 171 | if (intKey) { 172 | wkb.putInt(0, key, LITTLE_ENDIAN); 173 | } else { 174 | wkb.putStringWithoutLengthUtf8(0, padKey(key)); 175 | } 176 | if (valRandom) { 177 | wvb.putBytes(0, RND_MB, rndByteOffset, valSize); 178 | rndByteOffset += valSize; 179 | if (rndByteOffset >= rndByteMax) { 180 | rndByteOffset = 0; 181 | } 182 | } else { 183 | wvb.putInt(0, key); 184 | } 185 | batch.put(wkb.byteArray(), wvb.byteArray()); 186 | if (i % batchSize == 0) { 187 | db.write(batch); 188 | batch.close(); 189 | batch = db.createWriteBatch(); 190 | } 191 | } 192 | db.write(batch); // possible partial batch 193 | batch.close(); 194 | } 195 | } 196 | 197 | @State(Benchmark) 198 | public static class Reader extends CommonLevelDb { 199 | 200 | @Setup(Trial) 201 | @Override 202 | public void setup(final BenchmarkParams b) throws IOException { 203 | super.setup(b); 204 | super.write(num); 205 | } 206 | 207 | @TearDown(Trial) 208 | @Override 209 | public void teardown() throws IOException { 210 | super.teardown(); 211 | } 212 | } 213 | 214 | @State(Benchmark) 215 | @SuppressWarnings("checkstyle:visibilitymodifier") 216 | public static class Writer extends CommonLevelDb { 217 | 218 | @Param("1000000") 219 | int batchSize; 220 | 221 | @Setup(Invocation) 222 | @Override 223 | public void setup(final BenchmarkParams b) throws IOException { 224 | super.setup(b); 225 | } 226 | 227 | @TearDown(Invocation) 228 | @Override 229 | public void teardown() throws IOException { 230 | super.teardown(); 231 | } 232 | } 233 | 234 | } 235 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/LmdbJavaAgrona.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.lang.Boolean.TRUE; 24 | import static java.lang.System.setProperty; 25 | import static java.nio.ByteBuffer.allocateDirect; 26 | import static java.nio.ByteOrder.LITTLE_ENDIAN; 27 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 28 | import static net.openhft.hashing.LongHashFunction.xx_r39; 29 | import static org.agrona.concurrent.UnsafeBuffer.DISABLE_BOUNDS_CHECKS_PROP_NAME; 30 | import static org.lmdbjava.CopyFlags.MDB_CP_COMPACT; 31 | import static org.lmdbjava.DirectBufferProxy.PROXY_DB; 32 | import static org.lmdbjava.GetOp.MDB_SET_KEY; 33 | import static org.lmdbjava.PutFlags.MDB_APPEND; 34 | import static org.lmdbjava.SeekOp.MDB_FIRST; 35 | import static org.lmdbjava.SeekOp.MDB_LAST; 36 | import static org.lmdbjava.SeekOp.MDB_NEXT; 37 | import static org.lmdbjava.SeekOp.MDB_PREV; 38 | import static org.openjdk.jmh.annotations.Level.Invocation; 39 | import static org.openjdk.jmh.annotations.Level.Trial; 40 | import static org.openjdk.jmh.annotations.Mode.SampleTime; 41 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 42 | 43 | import java.io.IOException; 44 | 45 | import org.agrona.DirectBuffer; 46 | import org.agrona.MutableDirectBuffer; 47 | import org.agrona.concurrent.UnsafeBuffer; 48 | import org.lmdbjava.Cursor; 49 | import org.lmdbjava.PutFlags; 50 | import org.lmdbjava.Txn; 51 | import org.openjdk.jmh.annotations.Benchmark; 52 | import org.openjdk.jmh.annotations.BenchmarkMode; 53 | import org.openjdk.jmh.annotations.Fork; 54 | import org.openjdk.jmh.annotations.Measurement; 55 | import org.openjdk.jmh.annotations.OutputTimeUnit; 56 | import org.openjdk.jmh.annotations.Param; 57 | import org.openjdk.jmh.annotations.Setup; 58 | import org.openjdk.jmh.annotations.State; 59 | import org.openjdk.jmh.annotations.TearDown; 60 | import org.openjdk.jmh.annotations.Warmup; 61 | import org.openjdk.jmh.infra.BenchmarkParams; 62 | import org.openjdk.jmh.infra.Blackhole; 63 | 64 | @OutputTimeUnit(MILLISECONDS) 65 | @Fork(1) 66 | @Warmup(iterations = 3) 67 | @Measurement(iterations = 3) 68 | @BenchmarkMode(SampleTime) 69 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension"}) 70 | public class LmdbJavaAgrona { 71 | 72 | @Benchmark 73 | public void readCrc(final Reader r, final Blackhole bh) { 74 | r.crc.reset(); 75 | bh.consume(r.c.seek(MDB_FIRST)); 76 | do { 77 | r.txn.key().getBytes(0, r.keyBytes, 0, r.keySize); 78 | r.txn.val().getBytes(0, r.valBytes, 0, r.valSize); 79 | r.crc.update(r.keyBytes); 80 | r.crc.update(r.valBytes); 81 | } while (r.c.seek(MDB_NEXT)); 82 | bh.consume(r.crc.getValue()); 83 | } 84 | 85 | @Benchmark 86 | public void readKey(final Reader r, final Blackhole bh) { 87 | for (final int key : r.keys) { 88 | if (r.intKey) { 89 | r.rwKey.putInt(0, key); 90 | } else { 91 | r.rwKey.putStringWithoutLengthUtf8(0, r.padKey(key)); 92 | } 93 | bh.consume(r.c.get(r.rwKey, MDB_SET_KEY)); 94 | bh.consume(r.txn.val()); 95 | } 96 | } 97 | 98 | @Benchmark 99 | public void readRev(final Reader r, final Blackhole bh) { 100 | bh.consume(r.c.seek(MDB_LAST)); 101 | do { 102 | bh.consume(r.txn.val()); 103 | } while (r.c.seek(MDB_PREV)); 104 | } 105 | 106 | @Benchmark 107 | public void readSeq(final Reader r, final Blackhole bh) { 108 | bh.consume(r.c.seek(MDB_FIRST)); 109 | do { 110 | bh.consume(r.txn.val()); 111 | } while (r.c.seek(MDB_NEXT)); 112 | } 113 | 114 | @Benchmark 115 | public void readXxh64(final Reader r, final Blackhole bh) { 116 | long result = 0; 117 | bh.consume(r.c.seek(MDB_FIRST)); 118 | do { 119 | result += xx_r39().hashMemory(r.txn.key().addressOffset(), r.keySize); 120 | result += xx_r39().hashMemory(r.txn.val().addressOffset(), r.valSize); 121 | } while (r.c.seek(MDB_NEXT)); 122 | bh.consume(result); 123 | } 124 | 125 | @Benchmark 126 | public void write(final Writer w, final Blackhole bh) { 127 | w.write(); 128 | } 129 | 130 | @State(Benchmark) 131 | @SuppressWarnings("checkstyle:visibilitymodifier") 132 | public static class LmdbJava extends CommonLmdbJava { 133 | 134 | /** 135 | * CRC scratch (memory-mapped MDB can't return a byte[] or ByteBuffer). 136 | */ 137 | byte[] keyBytes; 138 | 139 | MutableDirectBuffer rwKey; 140 | MutableDirectBuffer rwVal; 141 | /** 142 | * CRC scratch (memory-mapped MDB can't return a byte[] or ByteBuffer). 143 | */ 144 | byte[] valBytes; 145 | 146 | static { 147 | setProperty(DISABLE_BOUNDS_CHECKS_PROP_NAME, TRUE.toString()); 148 | } 149 | 150 | @Override 151 | public void setup(final BenchmarkParams b, final boolean sync) throws 152 | IOException { 153 | super.setup(b, sync); 154 | keyBytes = new byte[keySize]; 155 | valBytes = new byte[valSize]; 156 | rwKey = new UnsafeBuffer(allocateDirect(keySize).order(LITTLE_ENDIAN)); 157 | rwVal = new UnsafeBuffer(allocateDirect(valSize)); 158 | } 159 | 160 | @SuppressWarnings("PMD.NullAssignment") 161 | void write() { 162 | try (Txn tx = env.txnWrite()) { 163 | try (Cursor c = db.openCursor(tx);) { 164 | final PutFlags flags = sequential ? MDB_APPEND : null; 165 | final int rndByteMax = RND_MB.length - valSize; 166 | int rndByteOffset = 0; 167 | for (final int key : keys) { 168 | if (intKey) { 169 | rwKey.putInt(0, key); 170 | } else { 171 | rwKey.putStringWithoutLengthUtf8(0, padKey(key)); 172 | } 173 | if (valRandom) { 174 | rwVal.putBytes(0, RND_MB, rndByteOffset, valSize); 175 | rndByteOffset += valSize; 176 | if (rndByteOffset >= rndByteMax) { 177 | rndByteOffset = 0; 178 | } 179 | } else { 180 | rwVal.putInt(0, key); 181 | } 182 | c.put(rwKey, rwVal, flags); 183 | } 184 | } 185 | tx.commit(); 186 | } 187 | } 188 | 189 | } 190 | 191 | @State(Benchmark) 192 | @SuppressWarnings("checkstyle:visibilitymodifier") 193 | public static class Reader extends LmdbJava { 194 | 195 | Cursor c; 196 | Txn txn; 197 | 198 | @Setup(Trial) 199 | @Override 200 | public void setup(final BenchmarkParams b) throws IOException { 201 | bufferProxy = PROXY_DB; 202 | super.setup(b, false); 203 | super.write(); 204 | final int maxValSizeForCopy = 4_081; // 2nd copy requires *2 /tmp space 205 | if (valSize <= maxValSizeForCopy && tmp.getName().contains(".readKey-")) { 206 | env.copy(compact, MDB_CP_COMPACT); 207 | reportSpaceUsed(compact, "compacted"); 208 | } 209 | txn = env.txnRead(); 210 | c = db.openCursor(txn); 211 | } 212 | 213 | @TearDown(Trial) 214 | @Override 215 | public void teardown() throws IOException { 216 | c.close(); 217 | txn.abort(); 218 | super.teardown(); 219 | } 220 | } 221 | 222 | @State(Benchmark) 223 | @SuppressWarnings("checkstyle:visibilitymodifier") 224 | public static class Writer extends LmdbJava { 225 | 226 | /** 227 | * Whether MDB_NOSYNC is used. 228 | */ 229 | @Param("false") 230 | boolean sync; 231 | 232 | @Setup(Invocation) 233 | @Override 234 | public void setup(final BenchmarkParams b) throws IOException { 235 | bufferProxy = PROXY_DB; 236 | super.setup(b, sync); 237 | } 238 | 239 | @TearDown(Invocation) 240 | @Override 241 | public void teardown() throws IOException { 242 | super.teardown(); 243 | } 244 | } 245 | 246 | } 247 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/LmdbJavaByteBuffer.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.nio.ByteBuffer.allocateDirect; 24 | import static java.nio.ByteOrder.LITTLE_ENDIAN; 25 | import static java.nio.charset.StandardCharsets.US_ASCII; 26 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 27 | import static net.openhft.hashing.LongHashFunction.xx_r39; 28 | import static org.lmdbjava.ByteBufferProxy.PROXY_OPTIMAL; 29 | import static org.lmdbjava.ByteBufferProxy.PROXY_SAFE; 30 | import static org.lmdbjava.GetOp.MDB_SET_KEY; 31 | import static org.lmdbjava.PutFlags.MDB_APPEND; 32 | import static org.lmdbjava.SeekOp.MDB_FIRST; 33 | import static org.lmdbjava.SeekOp.MDB_LAST; 34 | import static org.lmdbjava.SeekOp.MDB_NEXT; 35 | import static org.lmdbjava.SeekOp.MDB_PREV; 36 | import static org.openjdk.jmh.annotations.Level.Invocation; 37 | import static org.openjdk.jmh.annotations.Level.Trial; 38 | import static org.openjdk.jmh.annotations.Mode.SampleTime; 39 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 40 | 41 | import java.io.IOException; 42 | import java.nio.ByteBuffer; 43 | 44 | import org.lmdbjava.Cursor; 45 | import org.lmdbjava.PutFlags; 46 | import org.lmdbjava.Txn; 47 | import org.openjdk.jmh.annotations.Benchmark; 48 | import org.openjdk.jmh.annotations.BenchmarkMode; 49 | import org.openjdk.jmh.annotations.Fork; 50 | import org.openjdk.jmh.annotations.Measurement; 51 | import org.openjdk.jmh.annotations.OutputTimeUnit; 52 | import org.openjdk.jmh.annotations.Param; 53 | import org.openjdk.jmh.annotations.Setup; 54 | import org.openjdk.jmh.annotations.State; 55 | import org.openjdk.jmh.annotations.TearDown; 56 | import org.openjdk.jmh.annotations.Warmup; 57 | import org.openjdk.jmh.infra.BenchmarkParams; 58 | import org.openjdk.jmh.infra.Blackhole; 59 | 60 | @OutputTimeUnit(MILLISECONDS) 61 | @Fork(1) 62 | @Warmup(iterations = 3) 63 | @Measurement(iterations = 3) 64 | @BenchmarkMode(SampleTime) 65 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension"}) 66 | public class LmdbJavaByteBuffer { 67 | 68 | @Benchmark 69 | public void readCrc(final Reader r, final Blackhole bh) { 70 | r.crc.reset(); 71 | bh.consume(r.c.seek(MDB_FIRST)); 72 | do { 73 | r.crc.update(r.txn.key()); 74 | r.crc.update(r.txn.val()); 75 | } while (r.c.seek(MDB_NEXT)); 76 | bh.consume(r.crc.getValue()); 77 | } 78 | 79 | @Benchmark 80 | public void readKey(final Reader r, final Blackhole bh) { 81 | for (final int key : r.keys) { 82 | r.rwKey.clear(); 83 | if (r.intKey) { 84 | r.rwKey.putInt(key).flip(); 85 | } else { 86 | final byte[] str = r.padKey(key).getBytes(US_ASCII); 87 | r.rwKey.put(str, 0, str.length).flip(); 88 | } 89 | bh.consume(r.c.get(r.rwKey, MDB_SET_KEY)); 90 | bh.consume(r.txn.val()); 91 | } 92 | } 93 | 94 | @Benchmark 95 | public void readRev(final Reader r, final Blackhole bh) { 96 | bh.consume(r.c.seek(MDB_LAST)); 97 | do { 98 | bh.consume(r.txn.val()); 99 | } while (r.c.seek(MDB_PREV)); 100 | } 101 | 102 | @Benchmark 103 | public void readSeq(final Reader r, final Blackhole bh) { 104 | bh.consume(r.c.seek(MDB_FIRST)); 105 | do { 106 | bh.consume(r.txn.val()); 107 | } while (r.c.seek(MDB_NEXT)); 108 | } 109 | 110 | @Benchmark 111 | public void readXxh64(final Reader r, final Blackhole bh) { 112 | long result = 0; 113 | bh.consume(r.c.seek(MDB_FIRST)); 114 | do { 115 | result += xx_r39().hashBytes(r.txn.key()); 116 | result += xx_r39().hashBytes(r.txn.val()); 117 | } while (r.c.seek(MDB_NEXT)); 118 | bh.consume(result); 119 | } 120 | 121 | @Benchmark 122 | public void write(final Writer w, final Blackhole bh) { 123 | w.write(); 124 | } 125 | 126 | @State(Benchmark) 127 | @SuppressWarnings("checkstyle:visibilitymodifier") 128 | public static class LmdbJava extends CommonLmdbJava { 129 | 130 | ByteBuffer rwKey; 131 | ByteBuffer rwVal; 132 | 133 | @Override 134 | public void setup(final BenchmarkParams b, final boolean sync) throws 135 | IOException { 136 | super.setup(b, sync); 137 | rwKey = allocateDirect(keySize).order(LITTLE_ENDIAN); 138 | rwVal = allocateDirect(valSize); 139 | } 140 | 141 | @SuppressWarnings("PMD.NullAssignment") 142 | void write() { 143 | try (Txn tx = env.txnWrite();) { 144 | try (Cursor c = db.openCursor(tx);) { 145 | final PutFlags flags = sequential ? MDB_APPEND : null; 146 | final int rndByteMax = RND_MB.length - valSize; 147 | int rndByteOffset = 0; 148 | for (final int key : keys) { 149 | rwKey.clear(); 150 | rwVal.clear(); 151 | if (intKey) { 152 | rwKey.putInt(key).flip(); 153 | } else { 154 | final byte[] str = padKey(key).getBytes(US_ASCII); 155 | rwKey.put(str, 0, str.length).flip(); 156 | } 157 | if (valRandom) { 158 | rwVal.put(RND_MB, rndByteOffset, valSize).flip(); 159 | rndByteOffset += valSize; 160 | if (rndByteOffset >= rndByteMax) { 161 | rndByteOffset = 0; 162 | } 163 | } else { 164 | rwVal.putInt(key); 165 | rwVal.position(valSize); 166 | rwVal.flip(); 167 | } 168 | c.put(rwKey, rwVal, flags); 169 | } 170 | } 171 | tx.commit(); 172 | } 173 | } 174 | 175 | } 176 | 177 | @State(Benchmark) 178 | @SuppressWarnings("checkstyle:visibilitymodifier") 179 | public static class Reader extends LmdbJava { 180 | 181 | Cursor c; 182 | 183 | /** 184 | * Whether the byte buffer accessor is safe or not. 185 | */ 186 | @Param("false") 187 | boolean forceSafe; 188 | 189 | Txn txn; 190 | 191 | @Setup(Trial) 192 | @Override 193 | public void setup(final BenchmarkParams b) throws IOException { 194 | bufferProxy = forceSafe ? PROXY_SAFE : PROXY_OPTIMAL; 195 | super.setup(b, false); 196 | super.write(); 197 | txn = env.txnRead(); 198 | c = db.openCursor(txn); 199 | } 200 | 201 | @TearDown(Trial) 202 | @Override 203 | public void teardown() throws IOException { 204 | c.close(); 205 | txn.abort(); 206 | super.teardown(); 207 | } 208 | } 209 | 210 | @State(Benchmark) 211 | @SuppressWarnings("checkstyle:visibilitymodifier") 212 | public static class Writer extends LmdbJava { 213 | 214 | /** 215 | * Whether MDB_NOSYNC is used. 216 | */ 217 | @Param("false") 218 | boolean sync; 219 | 220 | @Setup(Invocation) 221 | @Override 222 | public void setup(final BenchmarkParams b) throws IOException { 223 | bufferProxy = PROXY_OPTIMAL; 224 | super.setup(b, sync); 225 | } 226 | 227 | @TearDown(Invocation) 228 | @Override 229 | public void teardown() throws IOException { 230 | super.teardown(); 231 | } 232 | } 233 | 234 | } 235 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/LmdbJni.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.lang.Boolean.TRUE; 24 | import static java.lang.System.setProperty; 25 | import static java.nio.ByteBuffer.allocateDirect; 26 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 27 | import static net.openhft.hashing.LongHashFunction.xx_r39; 28 | import static org.fusesource.lmdbjni.DirectBuffer.DISABLE_BOUNDS_CHECKS_PROP_NAME; 29 | import static org.lmdbjava.MaskedFlag.mask; 30 | import static org.lmdbjava.bench.CommonLmdbJava.POSIX_MODE; 31 | import static org.lmdbjava.bench.CommonLmdbJava.dbiFlags; 32 | import static org.lmdbjava.bench.CommonLmdbJava.envFlags; 33 | import static org.lmdbjava.bench.CommonLmdbJava.mapSize; 34 | import static org.openjdk.jmh.annotations.Level.Invocation; 35 | import static org.openjdk.jmh.annotations.Level.Trial; 36 | import static org.openjdk.jmh.annotations.Mode.SampleTime; 37 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 38 | 39 | import java.io.IOException; 40 | 41 | import org.fusesource.lmdbjni.BufferCursor; 42 | import org.fusesource.lmdbjni.Database; 43 | import org.fusesource.lmdbjni.DirectBuffer; 44 | import org.fusesource.lmdbjni.Env; 45 | import org.fusesource.lmdbjni.Transaction; 46 | import org.lmdbjava.DbiFlags; 47 | import org.lmdbjava.EnvFlags; 48 | import org.openjdk.jmh.annotations.Benchmark; 49 | import org.openjdk.jmh.annotations.BenchmarkMode; 50 | import org.openjdk.jmh.annotations.Fork; 51 | import org.openjdk.jmh.annotations.Measurement; 52 | import org.openjdk.jmh.annotations.OutputTimeUnit; 53 | import org.openjdk.jmh.annotations.Param; 54 | import org.openjdk.jmh.annotations.Setup; 55 | import org.openjdk.jmh.annotations.State; 56 | import org.openjdk.jmh.annotations.TearDown; 57 | import org.openjdk.jmh.annotations.Warmup; 58 | import org.openjdk.jmh.infra.BenchmarkParams; 59 | import org.openjdk.jmh.infra.Blackhole; 60 | 61 | @OutputTimeUnit(MILLISECONDS) 62 | @Fork(1) 63 | @Warmup(iterations = 3) 64 | @Measurement(iterations = 3) 65 | @BenchmarkMode(SampleTime) 66 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension"}) 67 | public class LmdbJni { 68 | 69 | @Benchmark 70 | public void readCrc(final Reader r, final Blackhole bh) { 71 | r.crc.reset(); 72 | bh.consume(r.c.first()); 73 | do { 74 | r.c.keyBuffer().getBytes(0, r.keyBytes, 0, r.keySize); 75 | r.c.valBuffer().getBytes(0, r.valBytes, 0, r.valSize); 76 | r.crc.update(r.keyBytes); 77 | r.crc.update(r.valBytes); 78 | } while (r.c.next()); 79 | bh.consume(r.crc.getValue()); 80 | } 81 | 82 | @Benchmark 83 | public void readKey(final Reader r, final Blackhole bh) { 84 | for (final int key : r.keys) { 85 | if (r.intKey) { 86 | r.wkb.putInt(0, key); 87 | } else { 88 | r.wkb.putStringWithoutLengthUtf8(0, r.padKey(key)); 89 | } 90 | r.c.keyWrite(r.wkb); 91 | bh.consume(r.c.seekKey()); 92 | bh.consume(r.c.valBuffer()); 93 | } 94 | } 95 | 96 | @Benchmark 97 | public void readRev(final Reader r, final Blackhole bh) { 98 | bh.consume(r.c.last()); 99 | do { 100 | bh.consume(r.c.valBuffer()); 101 | } while (r.c.prev()); 102 | } 103 | 104 | @Benchmark 105 | public void readSeq(final Reader r, final Blackhole bh) { 106 | bh.consume(r.c.first()); 107 | do { 108 | bh.consume(r.c.valBuffer()); 109 | } while (r.c.next()); 110 | } 111 | 112 | @Benchmark 113 | public void readXxh64(final Reader r, final Blackhole bh) { 114 | long result = 0; 115 | bh.consume(r.c.first()); 116 | do { 117 | result += xx_r39().hashMemory(r.c.keyBuffer().addressOffset(), r.keySize); 118 | result += xx_r39().hashMemory(r.c.valBuffer().addressOffset(), r.valSize); 119 | } while (r.c.next()); 120 | bh.consume(result); 121 | } 122 | 123 | @Benchmark 124 | public void write(final Writer w, final Blackhole bh) { 125 | w.write(); 126 | } 127 | 128 | @State(value = Benchmark) 129 | @SuppressWarnings("checkstyle:visibilitymodifier") 130 | public static class CommonLmdbJni extends Common { 131 | 132 | Database db; 133 | Env env; 134 | 135 | /** 136 | * CRC scratch (memory-mapped MDB can't return a byte[] or ByteBuffer). 137 | */ 138 | byte[] keyBytes; 139 | 140 | /** 141 | * CRC scratch (memory-mapped MDB can't return a byte[] or ByteBuffer). 142 | */ 143 | byte[] valBytes; 144 | 145 | /** 146 | * CRC scratch (memory-mapped MDB can't return a byte[] or ByteBuffer). 147 | */ 148 | DirectBuffer wkb; 149 | 150 | /** 151 | * Whether {@link EnvFlags#MDB_WRITEMAP} is used. 152 | */ 153 | @Param("true") 154 | boolean writeMap; 155 | 156 | /** 157 | * Writable value buffer. 158 | */ 159 | DirectBuffer wvb; 160 | 161 | static { 162 | setProperty(DISABLE_BOUNDS_CHECKS_PROP_NAME, TRUE.toString()); 163 | } 164 | 165 | public void setup(final BenchmarkParams b, final boolean sync) throws 166 | IOException { 167 | super.setup(b); 168 | wkb = new DirectBuffer(allocateDirect(keySize)); 169 | wvb = new DirectBuffer(allocateDirect(valSize)); 170 | keyBytes = new byte[keySize]; 171 | valBytes = new byte[valSize]; 172 | 173 | final EnvFlags[] envFlags = envFlags(writeMap, sync); 174 | 175 | env = new Env(); 176 | env.setMapSize(mapSize(num, valSize)); 177 | env.setMaxDbs(1); 178 | env.setMaxReaders(2); 179 | env.open(tmp.getAbsolutePath(), mask(envFlags), POSIX_MODE); 180 | 181 | try (Transaction tx = env.createWriteTransaction()) { 182 | final DbiFlags[] flags = dbiFlags(intKey); 183 | db = env.openDatabase(tx, "db", mask(flags)); 184 | tx.commit(); 185 | } 186 | } 187 | 188 | @Override 189 | public void teardown() throws IOException { 190 | reportSpaceBeforeClose(); 191 | env.close(); 192 | super.teardown(); 193 | } 194 | 195 | void write() { 196 | try (Transaction tx = env.createWriteTransaction()) { 197 | try (BufferCursor c = db.bufferCursor(tx);) { 198 | final int rndByteMax = RND_MB.length - valSize; 199 | int rndByteOffset = 0; 200 | for (final int key : keys) { 201 | if (intKey) { 202 | wkb.putInt(0, key); 203 | } else { 204 | wkb.putStringWithoutLengthUtf8(0, padKey(key)); 205 | } 206 | if (valRandom) { 207 | wvb.putBytes(0, RND_MB, rndByteOffset, valSize); 208 | rndByteOffset += valSize; 209 | if (rndByteOffset >= rndByteMax) { 210 | rndByteOffset = 0; 211 | } 212 | } else { 213 | wvb.putInt(0, key); 214 | } 215 | c.keyWrite(wkb); 216 | c.valWrite(wvb); 217 | if (sequential) { 218 | c.append(); 219 | } else { 220 | c.overwrite(); 221 | } 222 | } 223 | } 224 | tx.commit(); 225 | } 226 | } 227 | } 228 | 229 | @State(Benchmark) 230 | @SuppressWarnings("checkstyle:visibilitymodifier") 231 | public static class Reader extends CommonLmdbJni { 232 | 233 | BufferCursor c; 234 | Transaction tx; 235 | 236 | @Setup(Trial) 237 | @Override 238 | public void setup(final BenchmarkParams b) throws IOException { 239 | super.setup(b, false); 240 | super.write(); 241 | tx = env.createReadTransaction(); 242 | c = db.bufferCursor(tx); 243 | } 244 | 245 | @TearDown(Trial) 246 | @Override 247 | public void teardown() throws IOException { 248 | c.close(); 249 | tx.abort(); 250 | super.teardown(); 251 | } 252 | } 253 | 254 | @State(Benchmark) 255 | @SuppressWarnings("checkstyle:visibilitymodifier") 256 | public static class Writer extends CommonLmdbJni { 257 | 258 | /** 259 | * Whether {@link EnvFlags#MDB_NOSYNC} is used. 260 | */ 261 | @Param("false") 262 | boolean sync; 263 | 264 | @Setup(Invocation) 265 | @Override 266 | public void setup(final BenchmarkParams b) throws IOException { 267 | super.setup(b, sync); 268 | } 269 | 270 | @TearDown(Invocation) 271 | @Override 272 | public void teardown() throws IOException { 273 | super.teardown(); 274 | } 275 | } 276 | 277 | } 278 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/MapDb.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.nio.ByteOrder.LITTLE_ENDIAN; 24 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 25 | import static net.openhft.hashing.LongHashFunction.xx_r39; 26 | import static org.mapdb.DBMaker.fileDB; 27 | import static org.mapdb.Serializer.BYTE_ARRAY; 28 | import static org.openjdk.jmh.annotations.Level.Invocation; 29 | import static org.openjdk.jmh.annotations.Level.Trial; 30 | import static org.openjdk.jmh.annotations.Mode.SampleTime; 31 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 32 | 33 | import java.io.File; 34 | import java.io.IOException; 35 | import java.util.Iterator; 36 | import java.util.Map.Entry; 37 | 38 | import org.agrona.MutableDirectBuffer; 39 | import org.agrona.concurrent.UnsafeBuffer; 40 | import org.mapdb.BTreeMap; 41 | import org.mapdb.DB; 42 | import org.openjdk.jmh.annotations.Benchmark; 43 | import org.openjdk.jmh.annotations.BenchmarkMode; 44 | import org.openjdk.jmh.annotations.Fork; 45 | import org.openjdk.jmh.annotations.Measurement; 46 | import org.openjdk.jmh.annotations.OutputTimeUnit; 47 | import org.openjdk.jmh.annotations.Setup; 48 | import org.openjdk.jmh.annotations.State; 49 | import org.openjdk.jmh.annotations.TearDown; 50 | import org.openjdk.jmh.annotations.Warmup; 51 | import org.openjdk.jmh.infra.BenchmarkParams; 52 | import org.openjdk.jmh.infra.Blackhole; 53 | 54 | @OutputTimeUnit(MILLISECONDS) 55 | @Fork(1) 56 | @Warmup(iterations = 3) 57 | @Measurement(iterations = 3) 58 | @BenchmarkMode(SampleTime) 59 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension"}) 60 | public class MapDb { 61 | 62 | @Benchmark 63 | public void readCrc(final Reader r, final Blackhole bh) { 64 | r.crc.reset(); 65 | final Iterator> iterator = r.map.entryIterator(); 66 | while (iterator.hasNext()) { 67 | final Entry entry = iterator.next(); 68 | r.crc.update(entry.getKey()); 69 | r.crc.update(entry.getValue()); 70 | } 71 | bh.consume(r.crc.getValue()); 72 | } 73 | 74 | @Benchmark 75 | public void readKey(final Reader r, final Blackhole bh) { 76 | for (final int key : r.keys) { 77 | if (r.intKey) { 78 | r.wkb.putInt(0, key); 79 | } else { 80 | r.wkb.putStringWithoutLengthUtf8(0, r.padKey(key)); 81 | } 82 | bh.consume(r.map.get(r.wkb.byteArray())); 83 | } 84 | } 85 | 86 | @Benchmark 87 | public void readRev(final Reader r, final Blackhole bh) { 88 | final Iterator> iterator = r.map 89 | .descendingEntryIterator(); 90 | while (iterator.hasNext()) { 91 | final Entry entry = iterator.next(); 92 | bh.consume(entry.getValue()); 93 | } 94 | } 95 | 96 | @Benchmark 97 | public void readSeq(final Reader r, final Blackhole bh) { 98 | final Iterator> iterator = r.map.entryIterator(); 99 | while (iterator.hasNext()) { 100 | final Entry entry = iterator.next(); 101 | bh.consume(entry.getValue()); 102 | } 103 | } 104 | 105 | @Benchmark 106 | public void readXxh64(final Reader r, final Blackhole bh) { 107 | long result = 0; 108 | final Iterator> iterator = r.map.entryIterator(); 109 | while (iterator.hasNext()) { 110 | final Entry entry = iterator.next(); 111 | result += xx_r39().hashBytes(entry.getKey()); 112 | result += xx_r39().hashBytes(entry.getValue()); 113 | } 114 | bh.consume(result); 115 | } 116 | 117 | @Benchmark 118 | public void write(final Writer w, final Blackhole bh) { 119 | w.write(); 120 | } 121 | 122 | @State(value = Benchmark) 123 | @SuppressWarnings("checkstyle:visibilitymodifier") 124 | public static class CommonMapDb extends Common { 125 | 126 | DB db; 127 | BTreeMap map; 128 | 129 | /** 130 | * Writable key buffer. Backed by a plain byte[] for MapDb API ease. 131 | */ 132 | MutableDirectBuffer wkb; 133 | 134 | /** 135 | * Writable value buffer. Backed by a plain byte[] for MapDb API ease. 136 | */ 137 | MutableDirectBuffer wvb; 138 | 139 | @Override 140 | public void setup(final BenchmarkParams b) throws IOException { 141 | super.setup(b); 142 | wkb = new UnsafeBuffer(new byte[keySize]); 143 | wvb = new UnsafeBuffer(new byte[valSize]); 144 | db = fileDB(new File(tmp, "map.db")) 145 | .fileMmapEnable() 146 | .concurrencyDisable() 147 | .allocateStartSize(num * valSize) 148 | .make(); 149 | map = db.treeMap("ba2ba") 150 | .keySerializer(BYTE_ARRAY) 151 | .valueSerializer(BYTE_ARRAY) 152 | .createOrOpen(); 153 | } 154 | 155 | @Override 156 | public void teardown() throws IOException { 157 | reportSpaceBeforeClose(); 158 | db.close(); 159 | super.teardown(); 160 | } 161 | 162 | void write() { 163 | final int rndByteMax = RND_MB.length - valSize; 164 | int rndByteOffset = 0; 165 | for (final int key : keys) { 166 | if (intKey) { 167 | wkb.putInt(0, key, LITTLE_ENDIAN); 168 | } else { 169 | wkb.putStringWithoutLengthUtf8(0, padKey(key)); 170 | } 171 | if (valRandom) { 172 | wvb.putBytes(0, RND_MB, rndByteOffset, valSize); 173 | rndByteOffset += valSize; 174 | if (rndByteOffset >= rndByteMax) { 175 | rndByteOffset = 0; 176 | } 177 | } else { 178 | wvb.putInt(0, key); 179 | } 180 | map.put(wkb.byteArray(), wvb.byteArray()); 181 | } 182 | } 183 | } 184 | 185 | @State(Benchmark) 186 | public static class Reader extends CommonMapDb { 187 | 188 | @Setup(Trial) 189 | @Override 190 | public void setup(final BenchmarkParams b) throws IOException { 191 | super.setup(b); 192 | super.write(); 193 | } 194 | 195 | @TearDown(Trial) 196 | @Override 197 | public void teardown() throws IOException { 198 | super.teardown(); 199 | } 200 | } 201 | 202 | @State(Benchmark) 203 | public static class Writer extends CommonMapDb { 204 | 205 | @Setup(Invocation) 206 | @Override 207 | public void setup(final BenchmarkParams b) throws IOException { 208 | super.setup(b); 209 | } 210 | 211 | @TearDown(Invocation) 212 | @Override 213 | public void teardown() throws IOException { 214 | super.teardown(); 215 | } 216 | } 217 | 218 | } 219 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/MvStore.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.nio.ByteOrder.LITTLE_ENDIAN; 24 | import static java.util.Arrays.copyOf; 25 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 26 | import static net.openhft.hashing.LongHashFunction.xx_r39; 27 | import static org.openjdk.jmh.annotations.Level.Invocation; 28 | import static org.openjdk.jmh.annotations.Level.Trial; 29 | import static org.openjdk.jmh.annotations.Mode.SampleTime; 30 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 31 | 32 | import java.io.File; 33 | import java.io.IOException; 34 | import java.util.Iterator; 35 | 36 | import org.agrona.MutableDirectBuffer; 37 | import org.agrona.concurrent.UnsafeBuffer; 38 | import org.h2.mvstore.MVMap; 39 | import org.h2.mvstore.MVStore; 40 | import org.openjdk.jmh.annotations.Benchmark; 41 | import org.openjdk.jmh.annotations.BenchmarkMode; 42 | import org.openjdk.jmh.annotations.Fork; 43 | import org.openjdk.jmh.annotations.Measurement; 44 | import org.openjdk.jmh.annotations.OutputTimeUnit; 45 | import org.openjdk.jmh.annotations.Setup; 46 | import org.openjdk.jmh.annotations.State; 47 | import org.openjdk.jmh.annotations.TearDown; 48 | import org.openjdk.jmh.annotations.Warmup; 49 | import org.openjdk.jmh.infra.BenchmarkParams; 50 | import org.openjdk.jmh.infra.Blackhole; 51 | 52 | @OutputTimeUnit(MILLISECONDS) 53 | @Fork(1) 54 | @Warmup(iterations = 3) 55 | @Measurement(iterations = 3) 56 | @BenchmarkMode(SampleTime) 57 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension"}) 58 | public class MvStore { 59 | 60 | @Benchmark 61 | public void readCrc(final Reader r, final Blackhole bh) { 62 | r.crc.reset(); 63 | final Iterator iter = r.map.keyIterator(null); 64 | while (iter.hasNext()) { 65 | final byte[] k = iter.next(); 66 | final byte[] v = r.map.get(k); 67 | r.crc.update(k); 68 | r.crc.update(v); 69 | } 70 | bh.consume(r.crc.getValue()); 71 | } 72 | 73 | @Benchmark 74 | public void readKey(final Reader r, final Blackhole bh) { 75 | for (final int key : r.keys) { 76 | if (r.intKey) { 77 | r.wkb.putInt(0, key); 78 | } else { 79 | r.wkb.putStringWithoutLengthUtf8(0, r.padKey(key)); 80 | } 81 | bh.consume(r.map.get(copyOf(r.wkb.byteArray(), r.keySize))); 82 | } 83 | } 84 | 85 | @Benchmark 86 | public void readRev(final Reader r, final Blackhole bh) { 87 | for (long i = r.map.sizeAsLong() - 1; i >= 0; i--) { 88 | final byte[] k = r.map.getKey(i); 89 | bh.consume(r.map.get(k)); 90 | } 91 | } 92 | 93 | @Benchmark 94 | public void readSeq(final Reader r, final Blackhole bh) { 95 | final Iterator iter = r.map.keyIterator(null); 96 | while (iter.hasNext()) { 97 | final byte[] k = iter.next(); 98 | bh.consume(r.map.get(k)); 99 | } 100 | } 101 | 102 | @Benchmark 103 | public void readXxh64(final Reader r, final Blackhole bh) { 104 | long result = 0; 105 | final Iterator iter = r.map.keyIterator(null); 106 | while (iter.hasNext()) { 107 | final byte[] k = iter.next(); 108 | final byte[] v = r.map.get(k); 109 | result += xx_r39().hashBytes(k); 110 | result += xx_r39().hashBytes(v); 111 | } 112 | bh.consume(result); 113 | } 114 | 115 | @Benchmark 116 | public void write(final Writer w, final Blackhole bh) { 117 | w.write(); 118 | } 119 | 120 | @State(value = Benchmark) 121 | @SuppressWarnings("checkstyle:visibilitymodifier") 122 | public static class CommonMvStore extends Common { 123 | 124 | MVMap map; 125 | MVStore s; 126 | 127 | /** 128 | * Writable key buffer. Backed by a plain byte[] for MvStore API ease. 129 | */ 130 | MutableDirectBuffer wkb; 131 | 132 | /** 133 | * Writable value buffer. Backed by a plain byte[] for MvStore API ease. 134 | */ 135 | MutableDirectBuffer wvb; 136 | 137 | @Override 138 | public void setup(final BenchmarkParams b) throws IOException { 139 | super.setup(b); 140 | wkb = new UnsafeBuffer(new byte[keySize]); 141 | wvb = new UnsafeBuffer(new byte[valSize]); 142 | s = new MVStore.Builder() 143 | .fileName(new File(tmp, "mvstore.db").getAbsolutePath()) 144 | .autoCommitDisabled() 145 | .open(); 146 | map = s.openMap("ba2ba"); 147 | } 148 | 149 | @Override 150 | public void teardown() throws IOException { 151 | reportSpaceBeforeClose(); 152 | s.close(); 153 | super.teardown(); 154 | } 155 | 156 | void write() { 157 | final int rndByteMax = RND_MB.length - valSize; 158 | int rndByteOffset = 0; 159 | for (final int key : keys) { 160 | if (intKey) { 161 | wkb.putInt(0, key, LITTLE_ENDIAN); 162 | } else { 163 | wkb.putStringWithoutLengthUtf8(0, padKey(key)); 164 | } 165 | if (valRandom) { 166 | wvb.putBytes(0, RND_MB, rndByteOffset, valSize); 167 | rndByteOffset += valSize; 168 | if (rndByteOffset >= rndByteMax) { 169 | rndByteOffset = 0; 170 | } 171 | } else { 172 | wvb.putInt(0, key); 173 | } 174 | // MvStore requires this copy, otherwise it never stores > 1 entry 175 | map.put(copyOf(wkb.byteArray(), keySize), 176 | copyOf(wvb.byteArray(), valSize)); 177 | } 178 | s.commit(); 179 | } 180 | } 181 | 182 | @State(Benchmark) 183 | public static class Reader extends CommonMvStore { 184 | 185 | @Setup(Trial) 186 | @Override 187 | public void setup(final BenchmarkParams b) throws IOException { 188 | super.setup(b); 189 | super.write(); 190 | } 191 | 192 | @TearDown(Trial) 193 | @Override 194 | public void teardown() throws IOException { 195 | super.teardown(); 196 | } 197 | } 198 | 199 | @State(Benchmark) 200 | public static class Writer extends CommonMvStore { 201 | 202 | @Setup(Invocation) 203 | @Override 204 | public void setup(final BenchmarkParams b) throws IOException { 205 | super.setup(b); 206 | } 207 | 208 | @TearDown(Invocation) 209 | @Override 210 | public void teardown() throws IOException { 211 | super.teardown(); 212 | } 213 | } 214 | 215 | } 216 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/RocksDb.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.nio.ByteOrder.LITTLE_ENDIAN; 24 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 25 | import static net.openhft.hashing.LongHashFunction.xx_r39; 26 | import static org.openjdk.jmh.annotations.Level.Invocation; 27 | import static org.openjdk.jmh.annotations.Level.Trial; 28 | import static org.openjdk.jmh.annotations.Mode.SampleTime; 29 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 30 | import static org.rocksdb.CompressionType.NO_COMPRESSION; 31 | import static org.rocksdb.RocksDB.loadLibrary; 32 | import static org.rocksdb.RocksDB.open; 33 | 34 | import java.io.IOException; 35 | 36 | import org.agrona.MutableDirectBuffer; 37 | import org.agrona.concurrent.UnsafeBuffer; 38 | import org.openjdk.jmh.annotations.Benchmark; 39 | import org.openjdk.jmh.annotations.BenchmarkMode; 40 | import org.openjdk.jmh.annotations.Fork; 41 | import org.openjdk.jmh.annotations.Measurement; 42 | import org.openjdk.jmh.annotations.OutputTimeUnit; 43 | import org.openjdk.jmh.annotations.Param; 44 | import org.openjdk.jmh.annotations.Setup; 45 | import org.openjdk.jmh.annotations.State; 46 | import org.openjdk.jmh.annotations.TearDown; 47 | import org.openjdk.jmh.annotations.Warmup; 48 | import org.openjdk.jmh.infra.BenchmarkParams; 49 | import org.openjdk.jmh.infra.Blackhole; 50 | import org.rocksdb.Options; 51 | import org.rocksdb.RocksDB; 52 | import org.rocksdb.RocksDBException; 53 | import org.rocksdb.RocksIterator; 54 | import org.rocksdb.WriteBatch; 55 | import org.rocksdb.WriteOptions; 56 | 57 | @OutputTimeUnit(MILLISECONDS) 58 | @Fork(1) 59 | @Warmup(iterations = 3) 60 | @Measurement(iterations = 3) 61 | @BenchmarkMode(SampleTime) 62 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension"}) 63 | public class RocksDb { 64 | 65 | @Benchmark 66 | @SuppressWarnings("PMD.CloseResource") 67 | public void readCrc(final Reader r, final Blackhole bh) { 68 | r.crc.reset(); 69 | final RocksIterator iterator = r.db.newIterator(); 70 | iterator.seekToFirst(); 71 | while (iterator.isValid()) { 72 | r.crc.update(iterator.key()); 73 | r.crc.update(iterator.value()); 74 | iterator.next(); 75 | } 76 | bh.consume(r.crc.getValue()); 77 | } 78 | 79 | @Benchmark 80 | public void readKey(final Reader r, final Blackhole bh) throws 81 | RocksDBException { 82 | for (final int key : r.keys) { 83 | if (r.intKey) { 84 | r.wkb.putInt(0, key); 85 | } else { 86 | r.wkb.putStringWithoutLengthUtf8(0, r.padKey(key)); 87 | } 88 | bh.consume(r.db.get(r.wkb.byteArray(), r.wvb.byteArray())); 89 | } 90 | } 91 | 92 | @Benchmark 93 | @SuppressWarnings("PMD.CloseResource") 94 | public void readRev(final Reader r, final Blackhole bh) { 95 | final RocksIterator iterator = r.db.newIterator(); 96 | iterator.seekToLast(); 97 | while (iterator.isValid()) { 98 | bh.consume(iterator.value()); 99 | iterator.prev(); 100 | } 101 | } 102 | 103 | @Benchmark 104 | @SuppressWarnings("PMD.CloseResource") 105 | public void readSeq(final Reader r, final Blackhole bh) { 106 | final RocksIterator iterator = r.db.newIterator(); 107 | iterator.seekToFirst(); 108 | while (iterator.isValid()) { 109 | bh.consume(iterator.value()); 110 | iterator.next(); 111 | } 112 | } 113 | 114 | @Benchmark 115 | @SuppressWarnings("PMD.CloseResource") 116 | public void readXxh64(final Reader r, final Blackhole bh) { 117 | long result = 0; 118 | final RocksIterator iterator = r.db.newIterator(); 119 | iterator.seekToFirst(); 120 | while (iterator.isValid()) { 121 | result += xx_r39().hashBytes(iterator.key()); 122 | result += xx_r39().hashBytes(iterator.value()); 123 | iterator.next(); 124 | } 125 | bh.consume(result); 126 | } 127 | 128 | @Benchmark 129 | public void write(final Writer w, final Blackhole bh) throws IOException { 130 | w.write(w.batchSize); 131 | } 132 | 133 | @State(value = Benchmark) 134 | @SuppressWarnings("checkstyle:visibilitymodifier") 135 | public static class CommonRocksDb extends Common { 136 | 137 | RocksDB db; 138 | 139 | /** 140 | * Writable key buffer. Backed by a plain byte[] for RocksDB API ease. 141 | */ 142 | MutableDirectBuffer wkb; 143 | 144 | /** 145 | * Writable value buffer. Backed by a plain byte[] for RocksDB API ease. 146 | */ 147 | MutableDirectBuffer wvb; 148 | 149 | @Override 150 | @SuppressWarnings("PMD.CloseResource") 151 | public void setup(final BenchmarkParams b) throws IOException { 152 | super.setup(b); 153 | wkb = new UnsafeBuffer(new byte[keySize]); 154 | wvb = new UnsafeBuffer(new byte[valSize]); 155 | loadLibrary(); 156 | final Options options = new Options(); 157 | options.setCreateIfMissing(true); 158 | options.setCompressionType(NO_COMPRESSION); 159 | try { 160 | db = open(options, tmp.getAbsolutePath()); 161 | } catch (final RocksDBException ex) { 162 | throw new IOException(ex); 163 | } 164 | } 165 | 166 | @Override 167 | public void teardown() throws IOException { 168 | reportSpaceBeforeClose(); 169 | if (db != null) { 170 | db.close(); 171 | } 172 | super.teardown(); 173 | } 174 | 175 | @SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.CloseResource"}) 176 | void write(final int batchSize) throws IOException { 177 | final int rndByteMax = RND_MB.length - valSize; 178 | int rndByteOffset = 0; 179 | 180 | final WriteBatch batch = new WriteBatch(); 181 | final WriteOptions opt = new WriteOptions(); 182 | for (int i = 0; i < keys.length; i++) { 183 | final int key = keys[i]; 184 | if (intKey) { 185 | wkb.putInt(0, key, LITTLE_ENDIAN); 186 | } else { 187 | wkb.putStringWithoutLengthUtf8(0, padKey(key)); 188 | } 189 | if (valRandom) { 190 | wvb.putBytes(0, RND_MB, rndByteOffset, valSize); 191 | rndByteOffset += valSize; 192 | if (rndByteOffset >= rndByteMax) { 193 | rndByteOffset = 0; 194 | } 195 | } else { 196 | wvb.putInt(0, key); 197 | } 198 | try { 199 | batch.put(wkb.byteArray(), wvb.byteArray()); 200 | } catch (final RocksDBException ex) { 201 | throw new IOException(ex); 202 | } 203 | if (i % batchSize == 0) { 204 | try { 205 | db.write(opt, batch); 206 | } catch (final RocksDBException ex) { 207 | throw new IOException(ex); 208 | } 209 | batch.clear(); 210 | } 211 | } 212 | try { 213 | db.write(opt, batch); // possible partial batch 214 | } catch (final RocksDBException ex) { 215 | throw new IOException(ex); 216 | } 217 | batch.clear(); 218 | } 219 | } 220 | 221 | @State(Benchmark) 222 | public static class Reader extends CommonRocksDb { 223 | 224 | @Setup(Trial) 225 | @Override 226 | public void setup(final BenchmarkParams b) throws IOException { 227 | super.setup(b); 228 | super.write(num); 229 | } 230 | 231 | @TearDown(Trial) 232 | @Override 233 | public void teardown() throws IOException { 234 | super.teardown(); 235 | } 236 | } 237 | 238 | @State(Benchmark) 239 | @SuppressWarnings("checkstyle:visibilitymodifier") 240 | public static class Writer extends CommonRocksDb { 241 | 242 | @Param("1000000") 243 | int batchSize; 244 | 245 | @Setup(Invocation) 246 | @Override 247 | public void setup(final BenchmarkParams b) throws IOException { 248 | super.setup(b); 249 | } 250 | 251 | @TearDown(Invocation) 252 | @Override 253 | public void teardown() throws IOException { 254 | super.teardown(); 255 | } 256 | } 257 | 258 | } 259 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/Xodus.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | package org.lmdbjava.bench; 22 | 23 | import static java.util.Arrays.copyOfRange; 24 | import static java.util.concurrent.TimeUnit.MILLISECONDS; 25 | import static jetbrains.exodus.bindings.IntegerBinding.intToEntry; 26 | import static jetbrains.exodus.bindings.StringBinding.stringToEntry; 27 | import static jetbrains.exodus.env.Environments.newInstance; 28 | import static jetbrains.exodus.env.StoreConfig.WITHOUT_DUPLICATES_WITH_PREFIXING; 29 | import static net.openhft.hashing.LongHashFunction.xx_r39; 30 | import static org.lmdbjava.bench.Common.RND_MB; 31 | import static org.openjdk.jmh.annotations.Level.Invocation; 32 | import static org.openjdk.jmh.annotations.Level.Trial; 33 | import static org.openjdk.jmh.annotations.Mode.SampleTime; 34 | import static org.openjdk.jmh.annotations.Scope.Benchmark; 35 | 36 | import java.io.IOException; 37 | 38 | import jetbrains.exodus.ArrayByteIterable; 39 | import jetbrains.exodus.ByteIterable; 40 | import jetbrains.exodus.env.Cursor; 41 | import jetbrains.exodus.env.Environment; 42 | import jetbrains.exodus.env.EnvironmentConfig; 43 | import jetbrains.exodus.env.Store; 44 | import jetbrains.exodus.env.Transaction; 45 | import org.openjdk.jmh.annotations.Benchmark; 46 | import org.openjdk.jmh.annotations.BenchmarkMode; 47 | import org.openjdk.jmh.annotations.Fork; 48 | import org.openjdk.jmh.annotations.Measurement; 49 | import org.openjdk.jmh.annotations.OutputTimeUnit; 50 | import org.openjdk.jmh.annotations.Setup; 51 | import org.openjdk.jmh.annotations.State; 52 | import org.openjdk.jmh.annotations.TearDown; 53 | import org.openjdk.jmh.annotations.Warmup; 54 | import org.openjdk.jmh.infra.BenchmarkParams; 55 | import org.openjdk.jmh.infra.Blackhole; 56 | 57 | @OutputTimeUnit(MILLISECONDS) 58 | @Fork(1) 59 | @Warmup(iterations = 3) 60 | @Measurement(iterations = 3) 61 | @BenchmarkMode(SampleTime) 62 | @SuppressWarnings({"checkstyle:javadoctype", "checkstyle:designforextension"}) 63 | public class Xodus { 64 | 65 | @Benchmark 66 | public void readCrc(final Reader r, final Blackhole bh) { 67 | r.crc.reset(); 68 | try (Cursor c = r.store.openCursor(r.tx)) { 69 | while (c.getNext()) { 70 | r.crc.update(c.getKey().getBytesUnsafe(), 0, r.keySize); 71 | r.crc.update(c.getValue().getBytesUnsafe(), 0, r.valSize); 72 | } 73 | } 74 | bh.consume(r.crc.getValue()); 75 | } 76 | 77 | @Benchmark 78 | public void readKey(final Reader r, final Blackhole bh) { 79 | for (final int key : r.keys) { 80 | if (r.intKey) { 81 | final ByteIterable val = r.store.get(r.tx, intToEntry(key)); 82 | if (val != null) { 83 | bh.consume(val.getBytesUnsafe()); 84 | } 85 | } else { 86 | final ByteIterable val = r.store.get(r.tx, stringToEntry(r.padKey(key))); 87 | if (val != null) { 88 | bh.consume(val.getBytesUnsafe()); 89 | } 90 | } 91 | } 92 | } 93 | 94 | @Benchmark 95 | public void readRev(final Reader r, final Blackhole bh) { 96 | try (Cursor c = r.store.openCursor(r.tx)) { 97 | c.getLast(); 98 | do { 99 | bh.consume(c.getValue().getBytesUnsafe()); 100 | } while (c.getPrev()); 101 | } 102 | } 103 | 104 | @Benchmark 105 | public void readSeq(final Reader r, final Blackhole bh) { 106 | try (Cursor c = r.store.openCursor(r.tx)) { 107 | while (c.getNext()) { 108 | bh.consume(c.getValue().getBytesUnsafe()); 109 | } 110 | } 111 | } 112 | 113 | @Benchmark 114 | public void readXxh64(final Reader r, final Blackhole bh) { 115 | long result = 0; 116 | try (Cursor c = r.store.openCursor(r.tx)) { 117 | while (c.getNext()) { 118 | result += xx_r39().hashBytes(c.getKey().getBytesUnsafe(), 0, r.keySize); 119 | result += xx_r39(). 120 | hashBytes(c.getValue().getBytesUnsafe(), 0, r.valSize); 121 | } 122 | } 123 | bh.consume(result); 124 | } 125 | 126 | @Benchmark 127 | public void write(final Writer w, final Blackhole bh) { 128 | w.write(); 129 | } 130 | 131 | @State(value = Benchmark) 132 | @SuppressWarnings("checkstyle:visibilitymodifier") 133 | public static class CommonXodus extends Common { 134 | 135 | Environment env; 136 | Store store; 137 | 138 | @Override 139 | public void setup(final BenchmarkParams b) throws IOException { 140 | super.setup(b); 141 | 142 | final EnvironmentConfig cfg = new EnvironmentConfig(); 143 | // size of immutable .xd file is 32MB 144 | cfg.setLogFileSize(32 * 1_024); 145 | cfg.setLogCachePageSize(0x2_0000); 146 | env = newInstance(tmp, cfg); 147 | 148 | env.executeInTransaction((final Transaction txn) -> { 149 | // WITHOUT_DUPLICATES_WITH_PREFIXING means Patricia tree is used, 150 | // not B+Tree (WITHOUT_DUPLICATES) 151 | // Patricia tree gives faster random access, both for reading and writing 152 | store = env.openStore("without_dups", WITHOUT_DUPLICATES_WITH_PREFIXING, 153 | txn); 154 | }); 155 | } 156 | 157 | @Override 158 | public void teardown() throws IOException { 159 | reportSpaceBeforeClose(); 160 | env.close(); 161 | super.teardown(); 162 | } 163 | 164 | @SuppressWarnings({"PMD.AvoidInstantiatingObjectsInLoops", 165 | "PMD.ForLoopVariableCount"}) 166 | void write() { 167 | // optimal w/ valSize=16368 + default run 168 | final int batchSize = Math.max(1_000_000 / valSize, 1_000); 169 | final RandomBytesIterator rbi = new RandomBytesIterator(valSize); 170 | int k = 0; 171 | while (k < keys.length) { 172 | // write in several transactions so as not to block GC 173 | final int keyStartIndex = k; 174 | k += batchSize; 175 | env.executeInTransaction((final Transaction tx) -> { 176 | for (int i = 0, j = keyStartIndex; i < batchSize && j < keys.length; 177 | i++, j++) { 178 | final int key = keys[j]; 179 | final ByteIterable keyBi; 180 | final ByteIterable valBi; 181 | if (intKey) { 182 | keyBi = intToEntry(key); 183 | } else { 184 | keyBi = stringToEntry(padKey(key)); 185 | } 186 | if (valRandom) { 187 | valBi = new ArrayByteIterable(rbi.nextBytes()); 188 | } else { 189 | final byte[] bytes = new byte[valSize]; 190 | bytes[0] = (byte) (key >>> 24); 191 | bytes[1] = (byte) (key >>> 16); 192 | bytes[2] = (byte) (key >>> 8); 193 | bytes[3] = (byte) key; 194 | valBi = new ArrayByteIterable(bytes, valSize); 195 | } 196 | if (sequential) { 197 | store.putRight(tx, keyBi, valBi); 198 | } else { 199 | store.put(tx, keyBi, valBi); 200 | } 201 | } 202 | }); 203 | } 204 | } 205 | } 206 | 207 | @State(Benchmark) 208 | @SuppressWarnings("checkstyle:visibilitymodifier") 209 | public static class Reader extends CommonXodus { 210 | 211 | Transaction tx; 212 | 213 | @Setup(Trial) 214 | @Override 215 | public void setup(final BenchmarkParams b) throws IOException { 216 | super.setup(b); 217 | super.write(); 218 | tx = env.beginReadonlyTransaction(); 219 | // cannot share Cursor, as there's no Cursor.getFirst() to reset methods 220 | } 221 | 222 | @TearDown(Trial) 223 | @Override 224 | public void teardown() throws IOException { 225 | tx.abort(); 226 | super.teardown(); 227 | } 228 | } 229 | 230 | @State(Benchmark) 231 | public static class Writer extends CommonXodus { 232 | 233 | @Setup(Invocation) 234 | @Override 235 | public void setup(final BenchmarkParams b) throws IOException { 236 | super.setup(b); 237 | } 238 | 239 | @TearDown(Invocation) 240 | @Override 241 | public void teardown() throws IOException { 242 | super.teardown(); 243 | } 244 | } 245 | 246 | private static class RandomBytesIterator { 247 | 248 | private int i; 249 | private final int rndByteMax; 250 | private final int valSize; 251 | 252 | RandomBytesIterator(final int valSize) { 253 | this.valSize = valSize; 254 | rndByteMax = RND_MB.length - valSize; 255 | i = 0; 256 | } 257 | 258 | byte[] nextBytes() { 259 | final byte[] result = copyOfRange(RND_MB, i, valSize); 260 | i += valSize; 261 | if (i >= rndByteMax) { 262 | i = 0; 263 | } 264 | return result; 265 | } 266 | } 267 | } 268 | -------------------------------------------------------------------------------- /src/main/java/org/lmdbjava/bench/package-info.java: -------------------------------------------------------------------------------- 1 | /*- 2 | * #%L 3 | * LmdbJava Benchmarks 4 | * %% 5 | * Copyright (C) 2016 - 2022 The LmdbJava Open Source Project 6 | * %% 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * #L% 19 | */ 20 | 21 | /** 22 | * LMDB benchmarks. 23 | */ 24 | package org.lmdbjava.bench; 25 | --------------------------------------------------------------------------------