Skip to content

Instantly share code, notes, and snippets.

@SamSaffron
Created April 27, 2016 23:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SamSaffron/f73fd0395e050e927d1a3137373eeaee to your computer and use it in GitHub Desktop.
Save SamSaffron/f73fd0395e050e927d1a3137373eeaee to your computer and use it in GitHub Desktop.
require 'memory_profiler'
LONG_STRING = " this is a longer test
this is a longer test
this is a longer test
this is a longer test
this is a longer test"
MemoryProfiler.report do
LONG_STRING.empty? || !(/[[:^space:]]/ === LONG_STRING)
end.pretty_print
gets
MemoryProfiler.report do
LONG_STRING.empty? || (/\A[[:space:]]*\z/ === LONG_STRING)
end.pretty_print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment