Skip to content

Instantly share code, notes, and snippets.

View byroot's full-sized avatar

Jean Boussier byroot

View GitHub Profile
@byroot
byroot / raw.txt
Created August 6, 2026 08:15
RHASH_TBL usage
2010-10-21 KappaCUDA-1.5.0/KappaCUDA_wrap.cpp:#ifndef RHASH_TBL
2010-10-21 KappaCUDA-1.5.0/KappaCUDA_wrap.cpp:# define RHASH_TBL(x) (RHASH(x)->tbl)
2026-04-17 OpalKelly-6.0.0/ext/OpalKelly/FrontPanelDLL_wrap.cxx:#ifndef RHASH_TBL
2026-04-17 OpalKelly-6.0.0/ext/OpalKelly/FrontPanelDLL_wrap.cxx:# define RHASH_TBL(x) (RHASH(x)->tbl)
2013-05-03 RocketAMF-ouvrages-1.0.0/ext/rocketamf_ext/class_mapping.c: st_foreach(RHASH_TBL(props), mapping_populate_iter, (st_data_t)args);
2013-05-03 RocketAMF-ouvrages-1.0.0/ext/rocketamf_ext/class_mapping.c: st_foreach(RHASH_TBL(dynamic_props), mapping_populate_iter, (st_data_t)args);
2016-08-10 SysVIPC-0.10.0/ext/SysVIPC/SysVIPC.c:#ifndef RHASH_TBL
2016-08-10 SysVIPC-0.10.0/ext/SysVIPC/SysVIPC.c:# define RHASH_TBL(x) (RHASH(x)->tbl)
2009-03-23 adamh-hpricot-0.7.229/ext/hpricot_scan/hpricot_scan.c:#ifndef RHASH_TBL
2009-03-23 adamh-hpricot-0.7.229/ext/hpricot_scan/hpricot_scan.rl:#ifndef RHASH_TBL
require 'bundler/inline'
gemfile do
gem "benchmark-ips"
gem "connection_pool"
end
class ActiveRecordQueue
def initialize(lock = Monitor.new)
@lock = lock
# require "objspace"
# puts ObjectSpace.dump(Object.new)
# puts ObjectSpace.dump(Object.new.tap(&:object_id))
# puts ObjectSpace.dump_all(since: 1, output: :stdout)
o = Object.new
p [o.object_id, o.object_id]
o = Marshal.load(Marshal.dump(o))
p [o.object_id, o.object_id]
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
gem "benchmark-ips"
end
require "benchmark/ips"
@byroot
byroot / _notes.md
Last active January 28, 2025 12:11

Things to know

  • Lobsters doesn't use Puma's preload_app! because it relies on phased restarts. This seem to cause massive GVL contention after a deploy.
  • Would be worth trying to exclude that data, but aside from the very begining it's not clear where deploys are in the dataset. Need to check with @pushcx.

Observations

  • The IO heavy requests are in the higher percentile.
  • IO heavy requests are the one suffering the most from GVL contention.
  • Which makes sense, the more IO you do, the more you need to re-acquire the GVL, so the most you suffer if it is contented.
require 'json'
path = ARGV.first
class Request
attr_reader :gc_ms, :run_ms, :idle_ms, :stall_ms, :io_percent, :method, :action
def initialize(hash)
@gc_ms = hash[:gc_ms]
@run_ms = hash[:run_ms]
src_count = frozen_src_count = 0
ARGV.each do |gem_path|
Dir.glob(File.join(gem_path, "**/*.rb")) do |file|
next unless File.file?(file) && File.readable?(file)
src_count += 1
frozen_src_count += 1 if File.binread(file) =~ /^# frozen[-_]string[-_]literal: (true|false)$/
end
end
require 'benchmark/ips'
require 'oj'
require 'json'
puts "Ruby version: #{RUBY_VERSION}"
puts "Oj version: #{Oj::VERSION}"
puts "JSON version: #{JSON::VERSION}"
json_encoder = JSON::State.new(JSON.dump_default_options)
# Sample data to hash - using varied data types
@byroot
byroot / idea.md
Created January 28, 2024 23:03
Relation refactoring idea
  • Extending -> record module and method_missing + bind_call (confirm that bind call doesn't allocate metaclass).
  • Single generic Relation class. Stop dynamic method generation.
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'benchmark-ips'
end
require 'benchmark/ips'