Skip to content

Instantly share code, notes, and snippets.

@wycats

wycats/shipit.rb Secret

Forked from anonymous/-
Last active December 27, 2015 13:09
Show Gist options
  • Save wycats/49678fe276a990289133 to your computer and use it in GitHub Desktop.
Save wycats/49678fe276a990289133 to your computer and use it in GitHub Desktop.
require "bundler/setup"
require "allocation_counter"
string = "hello"
scanner = StringScanner.new(string)
AllocationCounter.simple do
scanner.skip(/hello/)
end
# it (1 times)
# ============
# allocated: 1
# string: 1
AllocationCounter.simple do
scanner.skip(/hello/u)
end
# it (1 times)
# ============
# allocated: GOOD WORK! NO ALLOCATIONS :+1:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment