Skip to content

Instantly share code, notes, and snippets.

@cheald
Last active December 24, 2015 21:29
Show Gist options
  • Save cheald/6865939 to your computer and use it in GitHub Desktop.
Save cheald/6865939 to your computer and use it in GitHub Desktop.
require 'bson'
100_000.times {
buffer = BSON::ByteBuffer.new
buffer.prepend! "string"
}
100_000.times {
buffer = BSON::ByteBuffer.new "string"
buffer.prepend! "string"
}
# Now pass an array. This blows up because it ends up
# passing an array to the `case String` branch which
# causes #prepend! to attempt string operations on an Array.
buffer = BSON::ByteBuffer.new([0,0,0,0])
buffer.prepend! "string"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment