Skip to content

Instantly share code, notes, and snippets.

@technion
Last active August 29, 2015 14:06
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 technion/7759443b328d4bc7dc1e to your computer and use it in GitHub Desktop.
Save technion/7759443b328d4bc7dc1e to your computer and use it in GitHub Desktop.
$more xortime.rb
#!/usr/bin/env ruby
#technion@lolware.net
require 'absolute_time'
ITER = 100000000
i = 1
puts AbsoluteTime.realtime {
(ITER).times do
i = i ^ 49
end
}
i = 'a'
puts AbsoluteTime.realtime {
(ITER).times do
i = (i.ord ^ 'b'.ord).chr
end
}
$ ./xortime.rb
13.805093835107982
52.14712872263044
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment