Created
April 9, 2020 13:55
-
-
Save casperisfine/fc7872df42c3c72508f828d9edf3b129 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
require 'lmdb' | |
require 'benchmark/ips' | |
PATH = __FILE__ | |
MAX_SIZE = 134217728 # 128 MB | |
FileUtils.mkdir_p('/tmp/lmdb-bench') | |
@env = ::LMDB.new('/tmp/lmdb-bench', mapsize: MAX_SIZE, nometasync: true, nosync: true) | |
@database = @env.database('bootsnap', create: true) | |
@database.put(PATH, File.read(PATH)) | |
Benchmark.ips do |x| | |
x.report("current-bootsnap") { File.read(PATH) } | |
x.report("LMDB.get") { @database.get(PATH) } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Warming up -------------------------------------- | |
current-bootsnap 5.064k i/100ms | |
LMDB.get 21.102k i/100ms | |
Calculating ------------------------------------- | |
current-bootsnap 52.489k (± 2.1%) i/s - 263.328k in 5.019150s | |
LMDB.get 226.234k (± 1.5%) i/s - 1.140M in 5.038054s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment