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
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source 'https://rubygems.org' | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem 'activerecord', github: 'rails/rails' |
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
default: &default | |
adapter: mysql2 | |
username: root | |
host: 192.168.64.72 | |
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | |
timeout: 5000 | |
default_animals: &default_animals | |
<<: *default | |
migrations_paths: db/animals_migrate |
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
require 'zlib' | |
require 'benchmark' | |
require 'rubygems/package' | |
require 'rubygems/package/tar_reader' | |
duration = Benchmark.realtime do | |
tar = Gem::Package::TarReader.new(Zlib::GzipReader.open(ARGV.first)) | |
tar.each { |_| } | |
end |
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
require 'fileutils' | |
require 'lmdb' | |
require 'benchmark/ips' | |
PATH = __FILE__ | |
MAX_SIZE = 134217728 # 128 MB | |
FileUtils.mkdir_p('/tmp/lmdb-bench') | |
@env = ::LMDB.new('/tmp/lmdb-bench', mapsize: MAX_SIZE, nometasync: true, nosync: true) | |
@database = @env.database('bootsnap', create: true) |
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
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'activerecord' | |
gem 'benchmark-ips' | |
end | |
require 'benchmark/ips' |
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
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "activerecord" |
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
# frozen_string_literal: true | |
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do | |
source "https://rubygems.org" |
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
$ ruby -v | |
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19] | |
$ ruby /tmp/struct.rb | |
Warming up -------------------------------------- | |
hash 1.450M i/100ms | |
naive 8.267k i/100ms | |
lazy-cached 68.069k i/100ms | |
explicit 415.985k i/100ms | |
Calculating ------------------------------------- | |
hash 14.223M (± 3.4%) i/s - 71.047M in 5.001074s |
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
# typed: false | |
# frozen_string_literal: true | |
# On MRI Symbols can be of two types: static or dynamic | |
# | |
# Static symbols are the ones explicitly referenced in the source code (`:foo`), and they're fake objects. | |
# Meaning they don't actually exists, they're just a special type of reference like integers. They use close to | |
# no memory, are particularly fast to compare and are not garbage collected. | |
# | |
# Dynamic symbols are symbols built using `String#to_sym` and that don't have an existing equivalent static symbol. |
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
./configure -C --disable-install-doc --prefix=/opt/rubies/scratch |
OlderNewer