Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. require 'benchmark/ips'
  2.  
  3. SYM = :magic_key
  4. MYS = :key_magic
  5. STR = 'magic_key'
  6. RTS = 'key_magic'
  7.  
  8. Benchmark.ips do |x|
  9. x.config(time: 2, warmup: 1)
  10.  
  11. x.report('Symbol#==') do
  12. SYM == SYM
  13. end
  14.  
  15. x.report('Symbol#!=') do
  16. SYM == MYS
  17. end
  18.  
  19. x.report('String#==') do
  20. STR == STR
  21. end
  22.  
  23. x.report('String#!=') do
  24. STR == RTS
  25. end
  26.  
  27. x.compare!
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement