In particular the update from 2022-04-26 23:54:00 UTC
For the protection of our customers, we will not be reconnecting to GitHub until we are certain that we can do so safely, **which may take some time
| results = Hash.new { |h,k| h[k] = Hash.new(0) } | |
| count = (ARGV.shift || 10).to_i | |
| durations = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0] | |
| puts "Running sleep(duration) #{count} times each" | |
| durations.each do |duration| | |
| count.times do | |
| zzz = sleep(duration) | |
| results[duration][zzz] += 1 | 
| pkg_config: checking for pkg-config for /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc... -------------------- ["-I/home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/include ", "", "-lsqlite3"] | |
| LD_LIBRARY_PATH=.:/home/vagrant/.rbenv/versions/3.4.4/lib ASAN_OPTIONS=detect_leaks=0 pkg-config --exists /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc | |
| LD_LIBRARY_PATH=.:/home/vagrant/.rbenv/versions/3.4.4/lib ASAN_OPTIONS=detect_leaks=0 pkg-config --libs /home/vagrant/.rbenv/versions/3.4.4/lib/ruby/gems/3.4.0/gems/sqlite3-2.6.0/ports/x86_64-redhat-linux/sqlite3/3.49.1/lib/pkgconfig/sqlite3.pc | | |
| => "-lsqlite3 \n" | |
| LD_LIBRARY_PATH=.:/home/vagrant/.rbenv/versions/3.4.4/lib ASAN_OPTIONS=detect_leaks=0 "gcc -o conftest -I/home/vagrant/.rbenv/versions/3.4.4/include/ruby-3.4. | 
| require 'benchmark/ips' | |
| # This is a quick bemchmark to compare the performance of ways to convert | |
| # an integer to a base32 string, we want to comare a low-level way to do it | |
| # that uses bit shifting and a high-level way that uses the Integer#digits | |
| # | |
| # Turns out using the digits(32) method is faster than using bit shifting... | |
| # unless you turn on --yjit in which case the bit shifting loop is better | |
| # | |
| # Here are the results on my machine: | 
| module Searchable | |
| extend ActiveSupport::Concern | |
| included do | |
| include PgSearch::Model | |
| class_attribute :searchable_attributes, default: [] | |
| class_attribute :searchable_internal_attributes, default: [] | |
| multisearchable against: [ | |
| :searchable_attributes_text, | |
| :custom_searchable_text | 
| #!/usr/bin/env ruby | |
| # Run this program on the commandline as: | |
| # | |
| # ruby day-1.rb <filename of csv> | |
| # | |
| # The output will be a prettified JSON representation of the result | |
| # | |
| require 'csv' | 
In particular the update from 2022-04-26 23:54:00 UTC
For the protection of our customers, we will not be reconnecting to GitHub until we are certain that we can do so safely, **which may take some time
| #!/usr/bin/env ruby | |
| require 'optimist' | |
| require 'thread' | |
| require 'socket' | |
| opts = Optimist::options do | |
| opt :host, "Hostname to connect to", default: "127.0.0.1" | |
| opt :port, "Port to connect to", default: 4332 | |
| opt :timeout, "Connection timeout", type: :integer | 
This is code associated with the blog post ...
| % bundle exec ./send-bench.rb | |
| Warming up -------------------------------------- | |
| native 973.581k i/100ms | |
| symbol 476.433k i/100ms | |
| string 355.763k i/100ms | |
| frozen 417.573k i/100ms | |
| constant-frozen 356.666k i/100ms | |
| instance_eval 738.433k i/100ms | |
| singleton_method 468.459k i/100ms | |
| subclass 794.878k i/100ms | 
| #!/usr/bin/env ruby | |
| line_number = 0 | |
| unique_counts = Hash.new(0) | |
| filename = ARGV.shift | |
| abort "filename needed" unless filename | |
| File.open(filename) do |f| | |
| header = f.readline.strip |