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 |
View camelize_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 'strscan' | |
module Inflector | |
def self.gsub_camelize(name) | |
name = name.to_s.dup | |
# sourced from: https://github.com/dry-rb/dry-inflector/blob/c918f967ff82611da374eb0847a77b7e012d3fa8/lib/dry/inflector.rb#L329-L334 |
View fork.cr
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
lib LibC | |
fun fork : PidT | |
fun wait(Int *) : PidT | |
fun waitpid(PidT, Int *, Int) : PidT | |
end | |
puts "Before fork" | |
pid = LibC.fork |
View string_building_benchmarks.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 'zlib' | |
Benchmark.bm(12) do |b| | |
n = 10_009_000 | |
str1 = 'A' | |
str2 = 'A' |
NewerOlder