Skip to content

Instantly share code, notes, and snippets.

View hubertlepicki's full-sized avatar

Hubert Łępicki hubertlepicki

View GitHub Profile
@hubertlepicki
hubertlepicki / bench.ex
Last active February 8, 2017 13:52 — forked from obrok/bench.ex
defmodule Bench do
def bench do
:timer.tc(fn -> Enum.reduce(Range.new(0, 10000000), 0, &Kernel.+/2) end) |> IO.inspect
:timer.tc(fn -> Enum.reduce(Range.new(0, 10000000), 0, fn acc, n -> acc + n end) end) |> IO.inspect
:timer.tc(fn -> Enum.reduce(Range.new(0, 10000000), 0, &(&1 + &2)) end) |> IO.inspect
nil
end
end
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 4.0"
gem "railties", "~> 4.0"
gem "tzinfo"
# Let's use thin