Today I Learned

hashrocket A Hashrocket project

Time terminal commands

If you enter time before any terminal command, it will output some information about how long the task took to run.

For example, let's run it on these two, crude, simple ruby scripts to see the time difference

# ./million.rb
1_000_000.times do
  2 + 2
end
Ruby
> time ruby million.rb
ruby million.rb  0.05s user 0.02s system 47% cpu 0.143 total
Bash

# ./billion.rb
1_000_000_000.times do
  2 + 2
end
Ruby
> time ruby billion.rb
ruby billion.rb  18.41s user 0.13s system 99% cpu 18.618 total
Bash

H/T Matt Polito

See More #command-line TILs