Created
September 24, 2012 21:28
-
-
Save kwilczynski/3778499 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main):009:0> quick(10_000) { x.inject({}) {|a,b| (a[b.first] ||= []) << b.last ; a }.map(&:flatten) } | |
Rehearsal ------------------------------------ | |
0.290000 0.040000 0.330000 ( 0.334947) | |
--------------------------- total: 0.330000sec | |
user system total real | |
0.310000 0.020000 0.330000 ( 0.327561) | |
=> nil | |
(main):010:0> quick(10_000) { Hash[*x].map { |k, v| [k.first, k.last, v.last] } } | |
Rehearsal ------------------------------------ | |
0.120000 0.020000 0.140000 ( 0.135189) | |
--------------------------- total: 0.140000sec | |
user system total real | |
0.110000 0.020000 0.130000 ( 0.143096) | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment