Skip to content

Instantly share code, notes, and snippets.

@johannesboyne
Last active May 10, 2016 11:43
Show Gist options
  • Save johannesboyne/00151191e4da122fd624ba4bfad19981 to your computer and use it in GitHub Desktop.
Save johannesboyne/00151191e4da122fd624ba4bfad19981 to your computer and use it in GitHub Desktop.
# $ iex -S mix --> 22 MB
KV.Registry.start_link(:kvname)
1..100_000
|> Enum.map(&(KV.Registry.create(:kvname, "list#{&1}")))
|> Enum.map(&(KV.Bucket.put(&1, "milk", :random.uniform)))
# --> 374 MB
1..100_000
|> Stream.map(&( KV.Registry.lookup(:kvname, "list#{&1}") ))
|> Stream.map(fn {:ok, bucket} -> KV.Bucket.get(bucket, "milk") end)
|> Enum.take_random(5)
# --> (peak) 381 MB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment