Skip to content

Instantly share code, notes, and snippets.

View casperisfine's full-sized avatar

Jean byroot Boussier casperisfine

View GitHub Profile
== Parsing activitypub.json (58160 bytes)
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) +YJIT [arm64-darwin23]
Warming up --------------------------------------
json 2.8.0.alpha1 891.000 i/100ms
oj 794.000 i/100ms
Calculating -------------------------------------
json 2.8.0.alpha1 8.879k (± 7.4%) i/s (112.62 μs/i) - 44.550k in 5.058132s
oj 7.916k (± 1.7%) i/s (126.32 μs/i) - 39.700k in 5.016420s
Comparison:
== Encoding citm_catalog.json (500298 bytes)
ruby 3.4.0preview2 (2024-10-07 master 32c733f57b) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
json (2.7.3) 123.000 i/100ms
oj 124.000 i/100ms
Calculating -------------------------------------
json (2.7.3) 1.312k (± 1.8%) i/s (761.91 μs/i) - 6.642k in 5.062192s
oj 1.278k (± 2.0%) i/s (782.35 μs/i) - 6.448k in 5.046587s
Comparison:
# frozen_string_literal: true
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'activesupport', github: 'rails/rails'
gem 'benchmark-ips'
end
#!/usr/bin/env ruby
# frozen_string_literal: true
require "json"
File.open(ARGV.first).each_line do |line|
if line.include?('"value":')
obj = JSON.parse(line)
obj.delete("value")
puts JSON.dump(obj)
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'benchmark-ips'
gem 'xrb'
gem 'erb'
gem 'erubi'
$ 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.
# 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"]
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
$ 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
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'benchmark-ips'
end
require 'benchmark/ips'