This file contains hidden or 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 | |
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do |
This file contains hidden or 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
def test(name) | |
module_eval("private; def #{name}; end") | |
end | |
def test2(name, private: nil) | |
module_eval("private; def #{name}; end") | |
end | |
module Foo | |
puts '-'* 40 |
This file contains hidden or 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
class UnserializableError < StandardError | |
def initialize(...) | |
super | |
@oops = -> () { } | |
end | |
end | |
NormalError = Class.new(StandardError) | |
error = begin |
This file contains hidden or 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
(gdb) thread apply all bt | |
Thread 60 (Thread 0x7fd3289ff700 (LWP 64)): | |
#0 futex_abstimed_wait_cancelable (private=<optimized out>, abstime=0x7fd3289fd590, clockid=<optimized out>, expected=0, futex_word=0x7fd3289fd5c8) at ../sysdeps/nptl/futex-internal.h:320 | |
#1 __pthread_cond_wait_common (abstime=0x7fd3289fd590, clockid=<optimized out>, mutex=0x55759e806e20 <thread_cache_lock>, cond=0x7fd3289fd5a0) at pthread_cond_wait.c:520 | |
#2 __pthread_cond_timedwait (cond=cond@entry=0x7fd3289fd5a0, mutex=mutex@entry=0x55759e806e20 <thread_cache_lock>, abstime=abstime@entry=0x7fd3289fd590) at pthread_cond_wait.c:665 | |
#3 0x000055759e40afe8 in native_cond_timedwait (abs=<synthetic pointer>, mutex=0x55759e806e20 <thread_cache_lock>, cond=0x7fd3289fd5a0) at thread_pthread.c:685 | |
#4 register_cached_thread_and_wait (altstack=0x7fd33f001280) at thread_pthread.c:1237 | |
#5 thread_start_func_1 (th_ptr=<optimized out>) at thread_pthread.c:1182 | |
#6 0x00007fd347d31609 in start_thread (arg=<optimized out>) at pthread_create.c:477 |
This file contains hidden or 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
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
gem "sqlite3" | |
gem "enumerable-statistics" | |
end | |
require "benchmark" |
This file contains hidden or 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 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'benchmark-ips' | |
end | |
require 'benchmark/ips' |
This file contains hidden or 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
$ bin/bench 5 | |
Puma starting in single mode... | |
* Puma version: 6.4.1 (ruby 3.3.0-p0) ("The Eagle of Durango") | |
* Min threads: 5 | |
* Max threads: 5 | |
* Environment: development | |
* PID: 87708 | |
Testing with: | |
75.0% time spent waiting on CPU | |
25.0% time spent waiting on IO |
This file contains hidden or 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
data_received..................: 13 kB 314 B/s | |
data_sent......................: 11 kB 271 B/s | |
http_req_blocked...............: min=211µs avg=402.09µs med=380µs max=1.51ms p(95)=553.99µs p(99)=639.66µs p(99.99)=1.5ms | |
http_req_connecting............: min=172µs avg=348.67µs med=340µs max=567µs p(95)=463.8µs p(99)=545.5µs p(99.99)=566.83µs | |
http_req_duration..............: min=276.1ms avg=382.56ms med=308.34ms max=816.25ms p(95)=648.15ms p(99)=798.75ms p(99.99)=816.1ms | |
{ expected_response:true }...: min=276.1ms avg=382.56ms med=308.34ms max=816.25ms p(95)=648.15ms p(99)=798.75ms p(99.99)=816.1ms | |
http_req_failed................: 0.00% ✓ 0 ✗ 139 | |
http_req_receiving.............: min=18µs avg=40.46µs med=39µs max=117µs p(95)=59µs p(99)=68.62µs p(99.99)=116.33µs | |
http_req_sending...............: min=17µs avg=29.12µs med=28µs max=65µs p(95)=40.09µs p(99)=47µs p(99.99)=64.75µs |
This file contains hidden or 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
# syntax = docker/dockerfile:1 | |
FROM ruby:3.3-slim | |
RUN apt-get update && apt-get install -y libjemalloc2 | |
RUN echo "#!/bin/sh\nexport LD_PRELOAD=$(echo /usr/lib/*/libjemalloc.so.2)\nexec \"\$@\"" >> /exec \ | |
&& chmod +x /exec | |
ENTRYPOINT ["/exec"] |
This file contains hidden or 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
$ rubocop --only Lint/UnusedMethodArgument unused.rb | |
Inspecting 1 file | |
W | |
Offenses: | |
unused.rb:1:9: W: [Correctable] Lint/UnusedMethodArgument: Unused method argument - bar. If it's necessary, use _ or _bar as an argument name to indicate that it won't be used. If it's unnecessary, remove it. You can also write as foo(*) if you want the method to accept any arguments but don't care about them. | |
def foo(bar, baz: 1) | |
^^^ | |
unused.rb:1:14: W: Lint/UnusedMethodArgument: Unused method argument - baz. You can also write as foo(*) if you want the method to accept any arguments but don't care about them. |