Skip to content

Instantly share code, notes, and snippets.

@frizop

frizop/stuff Secret

Created October 2, 2018 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frizop/c62c84254c8c0ee42c589e546863abac to your computer and use it in GitHub Desktop.
Save frizop/c62c84254c8c0ee42c589e546863abac to your computer and use it in GitHub Desktop.
stuff
[2] pry(main)> require 'benchmark'
=> true
[3] pry(main)> def check_file(file)
[3] pry(main)* filecheck = File.read(file)
[3] pry(main)* filecheck.match?(/do do/)
[3] pry(main)* end
=> :check_file
[4] pry(main)> Benchmark.bm(20) do |bm|
[4] pry(main)* bm.report("100 lines") {
[4] pry(main)* check_file("/home/jidar/Documents/src/ruby/lorem100")
[4] pry(main)* }
[4] pry(main)* bm.report("1000 lines") {
[4] pry(main)* check_file("/home/jidar/Documents/src/ruby/lorem1000")
[4] pry(main)* }
[4] pry(main)* end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment