For ruby:
require 'benchmark'
puts Benchmark.measure {(1..100_000).reduce(&:*); nil}.real
I get 7.48
to 7.68
seconds as the runtime on ruby 2.6.3 and 7.71
to 8.08
for ruby 3.0.0.
For elixir:
For ruby:
require 'benchmark'
puts Benchmark.measure {(1..100_000).reduce(&:*); nil}.real
I get 7.48
to 7.68
seconds as the runtime on ruby 2.6.3 and 7.71
to 8.08
for ruby 3.0.0.
For elixir:
18.828427654877792 = 113176610252/6010943257 | |
18.828427654877792 = 11644626562/618459851 | |
18.828427654877792 = 1206388604803/64072721680 | |
18.828427654877792 = 1351199027/71763774 | |
18.828427654877792 = 1444300989908416/76708529059475 | |
18.828427654877792 = 14697597531/780606740 | |
18.828427654877792 = 1525114896090/81000650933 | |
18.828427654877792 = 155558666430211/8261904248277 | |
18.828427654877792 = 16070294714071/853512306425 | |
18.828427654877792 = 17750568500/942753629 |
defmodule C do | |
def decompile(module, lang \\ :erlang) | |
def decompile(module, lang) when is_atom(module) do | |
decompile(:code.which(module), lang) | |
end | |
def decompile('', _) do | |
# When we get this, it's because a module name was passed |
if Object.const_defined?("Rails") | |
def r(model) | |
model.connection; | |
model.columns.map {|col| | |
[col.name, col.type] | |
}.to_h | |
end | |
def rp(model, filter = nil) |
-module(deriv). | |
-compile([export_all]). | |
nullable({rep, _}) -> true; | |
nullable({alt, Alts}) -> lists:any(fun nullable/1, Alts); | |
nullable(L) when is_list(L) -> lists:all(fun nullable/1, L); | |
nullable(_) -> false. | |
d(_, empty) -> empty; | |
d(_, []) -> empty; |
# Using the benchee library | |
keys = | |
1..12 | |
|> Enum.map(fn key -> | |
Integer.to_string(key) | |
end) | |
map = | |
keys |
class do(object): | |
def __init__(self, fn, *args, **kwargs): | |
self.fn = fn | |
self.args = args | |
self.kwargs = kwargs | |
def __rrshift__(self, other): | |
return self.fn(other, *self.args, **self.kwargs) | |
42 >> do(print) |
// 2520 is the smallest number that can be divided by each of | |
// the numbers from 1 to 10 without any remainder. | |
// | |
// What is the smallest positive number that is evenly | |
// divisible by all of the numbers from 1 to 20? | |
const std = @import("std"); | |
const assert = std.debug.assert; | |
const FactorMap = std.hash_map.AutoHashMap(u32, u32); |
[url "https://github.com/"] | |
insteadOf = git://github.com/ | |
insteadOf = git@github.com: | |
insteadOf = gh: | |
insteadOf = github: | |
[url "https://github.com/standard-analytics/"] | |
insteadOf = sa: | |
[url "https://git.apache.org/repos/asf/"] | |
insteadOf = apache: | |
[url "https://github.com/strmpnk/"] |
:(){ :|:& };: |