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
BEFORE: | |
sam@ubuntu discourse % rm -fr tmp/cache | |
sam@ubuntu discourse % rm -fr public/assets | |
sam@ubuntu discourse % time RAILS_ENV=production bin/rake assets:precompile | |
58.55s user 1.79s system 100% cpu 1:00.02 total | |
AFTER: |
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
build_package_reconfigure() { | |
test -f configure || autoconf | |
} | |
build_package_patch_ruby_railsexpress() { | |
fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master | |
patch -p1 < rvm-patchsets/patches/ruby/2.1.0/railsexpress/01-current-2.1.1-fixes.patch | |
patch -p1 < rvm-patchsets/patches/ruby/2.1.0/railsexpress/02-zero-broken-tests.patch | |
patch -p1 < rvm-patchsets/patches/ruby/2.1.0/railsexpress/03-improve-gc-stats.patch |
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
diff --git a/ext/dl/extconf.rb b/ext/dl/extconf.rb | |
index 898e4a7..122cf19 100644 | |
--- a/ext/dl/extconf.rb | |
+++ b/ext/dl/extconf.rb | |
@@ -1,7 +1,9 @@ | |
require 'mkmf' | |
if RbConfig::CONFIG['GCC'] == 'yes' | |
- $CFLAGS << " -fno-defer-pop -fno-omit-frame-pointer" | |
+ # $CFLAGS << " -fno-defer-pop -fno-omit-frame-pointer" |
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
module ActiveRecord::Batches | |
def find_in_batches(options = {}) | |
relation = self | |
unless arel.orders.blank? && arel.taken.blank? | |
ActiveRecord::Base.logger.warn("Scoped order and limit are ignored, it's forced to be batch order and batch size") | |
end | |
if (finder_options = options.except(:start, :batch_size)).present? | |
raise "You can't specify an order, it's forced to be #{batch_order}" if options[:order].present? |
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
# Bash snippet to open new shells in most recently visited dir. | |
# Useful if you want to open a new terminal tab at the present | |
# tab's location. | |
# | |
# Put this in your .bashrc or whatever. | |
pathed_cd () { | |
if [ "$1" == "" ]; then | |
\cd | |
else |
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
diff --git a/Gemfile b/Gemfile | |
index fd90d42..9dd0146 100644 | |
--- a/Gemfile | |
+++ b/Gemfile | |
@@ -1,4 +1,6 @@ | |
source 'http://rubygems.org' | |
+gem 'perftools.rb', '>= 0.4.4' | |
+gem 'rack-perftools_profiler' | |
gem 'rails', '3.0.0.rc' |
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
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
# 16 workers and 1 master | |
worker_processes (rails_env == 'production' ? 16 : 4) | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app 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
module ActionController | |
module Caching | |
module Fragments | |
def read_fragment_with_comment(name, options) | |
fragment = read_fragment_without_comment(name, options) | |
fragment && "\n<!-- cache-hit: #{name} -->\n#{fragment}\n<!-- /cache-hit: #{name} -->\n" || nil | |
end | |
alias_method_chain :read_fragment, :comment |
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
desc "cache assets" | |
task :cache_assets => :environment do | |
paths = ['public/javascripts/all.js', 'public/stylesheets/all.css'] | |
puts "-----> caching assets..." | |
paths.each do |path| | |
puts "-----> #{path}" | |
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
module CpuProf | |
require 'ffi' | |
extend FFI::Library | |
ffi_lib FFI::CURRENT_PROCESS | |
begin | |
attach_function :start, :ProfilerStart, [:string], :void | |
attach_function :stop, :ProfilerStop, [], :void | |
rescue FFI::NotFoundError => e | |
STDERR.puts "*** Are you sure you preloaded libprofiler?" |
OlderNewer