View benchmark.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
#!/usr/bin/env ruby | |
require 'benchmark' | |
Benchmark.bm do |b| | |
n = 1_000_000 | |
value1 = 1 | |
value2 = nil |
View benchmark.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
#!/usr/bin/env ruby | |
require 'benchmark' | |
class StaticDispatch | |
def dispatch | |
if rand > 0.5 | |
method1 | |
else |
View Gemfile
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
source 'https://rubygems.org/' | |
gem 'sinatra', '~> 2.0' | |
gem 'webrick' | |
gem 'thin' | |
gem 'puma' | |
gem 'unicorn' |
View array_addition_benchmark.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
#!/usr/bin/env ruby | |
require 'benchmark' | |
Benchmark.bm do |b| | |
n = 1_000_000 | |
array1 = [1,2,3,4,5,6] | |
array2 = [7,8,9,10,11,12,13,14] | |
array3 = [15,16,17,18,19,20] |
View test.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
TYPES: {:scope=>Namespace} | |
self::TYPES: {:scope=>Namespace::Mixin} |
View benchmark.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
#!/usr/bin/env ruby | |
require 'benchmark' | |
Benchmark.bm(20) do |b| | |
n = 10_000 | |
string = ('A' * n) + 'x' | |
b.report('String#include?(...))') do |
View github_issues_to_markdown.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
#!/usr/bin/env ruby | |
require 'optparse' | |
USAGE = "usage: #{$0} [options] GITHUB_REPO_URL [FILE]" | |
optparser = OptionParser.new do |opts| | |
opts.banner = USAGE | |
opts.separator '' |
View filter_repo.sh
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 bash | |
set -e | |
shopt -s globstar | |
github_user="FIXME" | |
orig_repo="FIXME" | |
new_repo="FIXME" | |
branch="main" |
View js_eval_hook.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
begin | |
require 'bundler/inline' | |
rescue LoadError => error | |
abort error.message | |
end | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'therubyracer' | |
end |
View arguments_benchmark.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
#!/usr/bin/env ruby | |
require 'benchmark' | |
require 'socket' | |
Benchmark.bm(20) do |b| | |
n = 10_000_000 | |
def positional_args(one,two,three,four,five) | |
end |
NewerOlder