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/memory' | |
require 'memory_profiler' | |
require 'benchmark/ips' | |
require 'psych' | |
require 'yaml' | |
file = File.read('./devise.en.yml') |
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
# This file extends the Kernel's require function and adds the | |
# AutoReload module which allows to reload files once they have changed | |
# on the disk. | |
# | |
# Basically, you just require your files as usual, and if you want to update | |
# the files, either call AutoReload.reload(file) or AutoReload.reload_all. | |
# | |
# Usage: | |
# irb -rautoload | |
# |
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/ips' | |
def very_good_content | |
1+2+3+4+5 | |
end | |
Benchmark.ips do |x| | |
x.report("string") { send :very_good_content } | |
x.report("symbol") { send 'very_good_content' } | |
x.report("string.to_sym") { send 'very_good_content'.to_sym } |
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
➜ xxx git:(----) ✗ bundle exec derailed bundle:mem CUT_OFF=0.3 | |
/Users/datle-eh/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.3/lib/active_support/core_ext/object/duplicable.rb:111: warning: BigDecimal.new is deprecated; use BigDecimal() method instead. | |
TOP: 164.4844 MiB | |
filestack: 55.8359 MiB | |
filestack/models/filelink: 55.793 MiB (Also required by: filestack/models/filestack_av) | |
filestack/utils/utils: 53.9414 MiB (Also required by: filestack/models/filestack_av, filestack/mixins/filestack_common, and 3 others) | |
mimemagic: 50.7422 MiB (Also required by: filestack/utils/multipart_upload_utils, filestack/mixins/filestack_common) | |
typhoeus: 3.0938 MiB (Also required by: filestack/utils/multipart_upload_utils) | |
typhoeus/hydra: 2.6211 MiB | |
typhoeus/hydra/block_connection: 2.5039 MiB |
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 'memory_profiler' | |
require 'benchmark/ips' | |
puts "Memory stats for requiring mini_mime" | |
result = MemoryProfiler.report do | |
require 'mini_mime' | |
end | |
puts "Total allocated: #{result.total_allocated_memsize} bytes (#{result.total_allocated} objects)" | |
puts "Memory stats for requiring marcel" |
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/memory" | |
require "benchmark/ips" | |
def option_hash(options = {}); end | |
def double_splat(**options); end | |
Benchmark.memory do |x| | |
x.report("mem option_hash") { option_hash(foo: 1, bar: 2) } | |
x.report("mem double_splat") { double_splat(foo: 1, bar: 2) } | |
# x.compare! |
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 | |
# rubocop:disable | |
require 'json' | |
require 'pry' | |
require 'pry-byebug' | |
# NOTE: going to logdna and download the jsonl and parse |
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
## Installing the NodeSource Node.js 10.x repo... | |
## Populating apt-get cache... | |
+ apt-get update | |
Hit:1 http://deb.debian.org/debian buster InRelease | |
Hit:2 http://security.debian.org/debian-security buster/updates InRelease | |
Hit:3 http://deb.debian.org/debian buster-updates InRelease | |
Ign:4 https://dl.bintray.com/fullstaq/fullstaq-ruby-apt debian-10 InRelease |
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
$ heroku login | |
# remember heroku instance is wellplayed with platform below | |
$ bundle lock --add-platform x86_64-linux --add-platform ruby | |
# remember postgres is wellplayed too | |
$ rails new app --database=postgresql | |
Assume you push already |
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
#fullstaq-ruby enables malloc-trim and jemalloc which is said to save up to 50% memory consumption | |
#ARG RUBY_VERSION=2.6.6-jemalloc | |
#FROM quay.io/evl.ms/fullstaq-ruby:${RUBY_VERSION}-slim | |
FROM swipesense/ruby-jemalloc:2.6-buster-slim | |
ENV LANG C.UTF-8 | |
ENV DEBIAN_FRONTEND noninteractive | |
# Specify JP mirror, other mirrors are less stable than JP's | |
RUN echo 'deb http://ftp.jp.debian.org/debian/ buster main contrib non-free' > /etc/apt/sources.list |