$ rails _5.1.6_ new -d postgresql --api --skip-test --skip-bundle --skip-git rails-api-5.1.6
$ rails _5.2.0_ new -d postgresql --api --skip-test --skip-bundle --skip-git rails-api-5.2.0
$ diff -ur rails-api-5.1.6/ rails-api-5.2.0/
This file contains hidden or 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 'csv' | |
| CSV.foreach(ARGV[0]) do |_| | |
| end | |
| __END__ | |
| $ time ruby benchmark-csv.rb 100chr-100col-10000row.csv | |
| 237.94 real 227.03 user 1.65 sys |
This file contains hidden or 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 'benchmark' | |
| require 'active_record' | |
| # $ docker run --rm -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres:9.6 | |
| # $ psql -h localhost -U postgres -d postgres | |
| ActiveRecord::Base.establish_connection( | |
| adapter: 'postgresql', | |
| encoding: 'unicode', | |
| host: 'localhost', | |
| database: 'postgres', |
This file contains hidden or 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 'benchmark' | |
| keys = Array.new(100) { |i| i } | |
| hash = Hash[keys.map(&:to_s).zip(keys)] | |
| TYPE = Struct.new('Type', *keys.map(&:to_s)) | |
| struct = TYPE.new(*keys) | |
| N = 100_000 | |
| Benchmark.bm(20) do |x| | |
| x.report('Hash') do |
This file contains hidden or 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 | |
| source "https://rubygems.org" | |
| git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } | |
| gem 'activerecord', '5.2.1' | |
| gem 'pg', '1.1.3' |
This file contains hidden or 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 'active_support' | |
| require 'active_support/subscriber' | |
| class Subscriber < ActiveSupport::Subscriber | |
| def event(event) | |
| end | |
| end | |
| Subscriber.attach_to :sample | |
| puts "### Not nested instrument\n\n" |
This file contains hidden or 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 'active_record' | |
| require 'benchmark' | |
| require 'csv' | |
| require 'uri' | |
| RECORD_SIZE = ENV.fetch('RECORD_SIZE', 10_000).to_i | |
| BULK_SIZE = ENV.fetch('BULK_SIZE', 100).to_i | |
| CONCURRENCY = ENV.fetch('CONCURRENCY', 4).to_i | |
| dsn = URI.parse(ENV['DATABASE_URL']) |
This file contains hidden or 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 'net/ftp' | |
| require 'tmpdir' | |
| require 'thwait' | |
| DEBUG = !ENV.fetch('DEBUG', '').empty? | |
| CONCURRENT = ENV.fetch('CONCURRENT').to_i | |
| FTP_HOST = ENV.fetch('FTP_HOST') | |
| FTP_PORT = ENV.fetch('FTP_PORT').to_i | |
| FTP_USER = ENV.fetch('FTP_USER') | |
| FTP_PASS = ENV.fetch('FTP_PASS') |
This file contains hidden or 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
| # see https://github.com/docker-library/ruby/blob/e5d5ed23036c66c5797c39e0e156de5d006dbfc0/2.5/alpine3.7/Dockerfile | |
| FROM alpine:3.7 | |
| # skip installing gem documentation | |
| RUN mkdir -p /usr/local/etc \ | |
| && { \ | |
| echo 'install: --no-document'; \ | |
| echo 'update: --no-document'; \ | |
| } >> /usr/local/etc/gemrc |
This file contains hidden or 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
| FROM alpine:3.7 | |
| # skip installing gem documentation | |
| RUN mkdir -p /usr/local/etc \ | |
| && { \ | |
| echo 'install: --no-document'; \ | |
| echo 'update: --no-document'; \ | |
| } >> /usr/local/etc/gemrc | |
| ENV RUBY_MAJOR 2.5 |