For ruby:
require 'benchmark'
puts Benchmark.measure {(1..100_000).reduce(&:*); nil}.realI 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}.realI 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:
| 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) |
| # 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); |
| :(){ :|:& };: |
| # This file has been auto-generated by i3-config-wizard(1). | |
| # It will not be overwritten, so edit it as you like. | |
| # | |
| # Should you change your keyboard layout some time, delete | |
| # this file and re-run i3-config-wizard(1). | |
| # | |
| # UPDATES: | |
| # | |
| # I've switched arrows to use IJKL as an arrow cluster to match some of | |
| # my custom keyboard layers. I find it a more intuitive homerow arrow layout |
| .Xauthority | |
| .Xresources | |
| .bash_history | |
| .bash_logout | |
| .bash_profile | |
| .bashrc | |
| .cache | |
| .config | |
| .dbus | |
| .dmenu_cache |
| [<RequireQualifiedAccess>] | |
| module Trace = | |
| /// StaticTracer allows tracers to be shared based on type. This allows us | |
| /// to avoid passing the tracer instance explicitly around. | |
| type private StaticTracer<'a>() = | |
| static member val event = Event<'a>() | |
| /// Emit a tracable value by trace type. | |
| let emit<'trace> x = |