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
#!/usr/bin/env ruby | |
# This script can be run against a local version of MemoryProfiler or the latest release for comparison | |
# Run at least once with --install-gems to ensure all required Gems are installed | |
# ruby ./mem_lite.rb --install-gems | |
# | |
# To run against local code | |
# ruby ./mem_lite.rb --local | |
# To run against latest release | |
# ruby ./mem_lite.rb | |
# |
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
+# This can be added to initializer to add logging | |
+# on the wildcard route such as this... | |
+# match ':controller(/:action(/:id))(.:format)', :via => :all, :as => 'wildcard' | |
+# Name the route 'wildcard' | |
+ | |
+module WildcardRouteWatcher | |
+ def find_routes(req) | |
+ routes = super | |
+ if routes.size > 0 | |
+ _match, parameters, route = routes[0] |
This file has been truncated, but you can view the full file.
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 'digest/sha2' | |
require 'benchmark' | |
require 'set' | |
module HashDigestUtils | |
extend self | |
ADD_VALUE_TO_DIGEST = { |
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
#!/usr/bin/env ruby | |
# This script is licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) | |
# Feel free to copy, modify, reuse as you would like without limitation. | |
# | |
# Save this file to the root directory where the awesome_print code is checked out. | |
# | |
# This script profiles the impact of awesome_print on taking difference of two arrays | |
# [1,2,3,4,5] - [3,4,5,6,7] | |
# The script measures memory allocations and iterations/sec before and after | |
# awesome_print has been loaded to demonstrate the impact |
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
#!/usr/bin/env ruby | |
# Copy this file to a ./benchmarks directory where the rabl code is checked out. | |
# On the first run, it will create a `posts.json.rabl` template. You can edit | |
# that file and re-run to see the effect of different templates. | |
# This benchmark script creates a sqlite DB and ActiveRecord objects for | |
# 10 Posts with 5 Comments that are then serialized using Rabl. | |
# This script can be run against a local version of Rabl or the latest release for comparison | |
# Run at least once with --install-gems to ensure all required Gems are installed | |
# ruby ./benchmark.rb --install-gems | |
# To run benchmark against local code |
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
# To run benchmark... | |
# rake clean | |
# rake compile | |
# ruby benchmarks/benchmark_profiler2.rb | |
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e |
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
# This benchmark script profiles a relatively simple 2-table ActiveRecord | |
# transaction to an in-memory database to generate a profile report. | |
# The script only benchmarks profiling, and not report printing. | |
# Save this file as ./benchmarks/benchmark_profiler.rb | |
# Run with `ruby ./benchmarks/benchmark_profiler` | |
begin | |
require 'bundler/inline' | |
rescue LoadError => e |
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
#!/usr/bin/env ruby | |
# To use this benchmark script, add a Gemfile.d/profiling.rb file with... | |
# gem 'memory_profiler' | |
# gem 'benchmark-ips' | |
# gem 'ruby-prof' | |
# This benchmark script file should be placed in the canvas-lms root directory | |
# and run as ./benchmark_switchman.rb <run_identifier> | |
# The identifier is optional and allows you to compare multiple runs more easily. |
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
#!/usr/bin/env ruby | |
# To use this benchmark script, add a Gemfile.d/profiling.rb file with... | |
# gem 'memory_profiler' | |
# gem 'benchmark-ips' | |
# gem 'ruby-prof' | |
# This benchmark script file should be placed in the canvas-lms root directory | |
# and run as ./benchmark_suspend.rb <run_identifier> | |
# The identifier is optional and allows you to compare multiple runs more easily. |
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
#!/usr/bin/env ruby | |
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
# Change this to true if you do not have the gems installed |
NewerOlder