Skip to content

Instantly share code, notes, and snippets.

@mostlyobvious
Created July 9, 2025 12:57
Show Gist options
  • Select an option

  • Save mostlyobvious/d536c01201c8c57af8d18b8ae664a382 to your computer and use it in GitHub Desktop.

Select an option

Save mostlyobvious/d536c01201c8c57af8d18b8ae664a382 to your computer and use it in GitHub Desktop.
require "rails_event_store"
require "benchmark/ips"
require_relative "support/helpers/schema_helper"
require_relative "support/helpers/migrator"
include SchemaHelper
establish_database_connection
load_database_schema
begin
original = RailsEventStore::JSONClient.new
remake = RailsEventStore::JSONClient.new
remake.rescue_from_double_json_serialization!
original.append(
100_000.times.map { RubyEventStore::Event.new(data: { kaka: "dudu" }, metadata: { event_type: "dummy" }) },
)
Benchmark.ips do |r|
r.report("original") { original.read.to_a }
r.report("remake") { remake.read.to_a }
r.compare!
end
ensure
drop_database
end
source "https://rubygems.org"
gem "benchmark-ips"
gem "rails_event_store", path: "."
gem "ruby_event_store", path: "."
gem "ruby_event_store-active_record", path: "."
gem "rails"
gem "pg"
gem "childprocess"
PATH
remote: .
specs:
aggregate_root (2.16.0)
ruby_event_store (= 2.16.0)
rails_event_store (2.16.0)
activejob (>= 6.0)
activemodel (>= 6.0)
activesupport (>= 6.0)
aggregate_root (= 2.16.0)
arkency-command_bus (>= 0.4)
rails_event_store_active_record (= 2.16.0)
ruby_event_store (= 2.16.0)
ruby_event_store-browser (= 2.16.0)
rails_event_store_active_record (2.16.0)
ruby_event_store-active_record (= 2.16.0)
ruby_event_store (2.16.0)
concurrent-ruby (~> 1.0, >= 1.1.6)
ruby_event_store-active_record (2.16.0)
activerecord (>= 6.0)
ruby_event_store (= 2.16.0)
ruby_event_store-browser (2.16.0)
rack
ruby_event_store (= 2.16.0)
GEM
remote: https://rubygems.org/
specs:
actioncable (7.2.2.1)
actionpack (= 7.2.2.1)
activesupport (= 7.2.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.2.2.1)
actionpack (= 7.2.2.1)
activejob (= 7.2.2.1)
activerecord (= 7.2.2.1)
activestorage (= 7.2.2.1)
activesupport (= 7.2.2.1)
mail (>= 2.8.0)
actionmailer (7.2.2.1)
actionpack (= 7.2.2.1)
actionview (= 7.2.2.1)
activejob (= 7.2.2.1)
activesupport (= 7.2.2.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.2.2.1)
actionview (= 7.2.2.1)
activesupport (= 7.2.2.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (7.2.2.1)
actionpack (= 7.2.2.1)
activerecord (= 7.2.2.1)
activestorage (= 7.2.2.1)
activesupport (= 7.2.2.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.2.2.1)
activesupport (= 7.2.2.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.2.2.1)
activesupport (= 7.2.2.1)
globalid (>= 0.3.6)
activemodel (7.2.2.1)
activesupport (= 7.2.2.1)
activerecord (7.2.2.1)
activemodel (= 7.2.2.1)
activesupport (= 7.2.2.1)
timeout (>= 0.4.0)
activestorage (7.2.2.1)
actionpack (= 7.2.2.1)
activejob (= 7.2.2.1)
activerecord (= 7.2.2.1)
activesupport (= 7.2.2.1)
marcel (~> 1.0)
activesupport (7.2.2.1)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
arkency-command_bus (0.4.1)
concurrent-ruby
base64 (0.3.0)
benchmark (0.4.1)
benchmark-ips (2.14.0)
bigdecimal (3.2.2)
builder (3.3.0)
childprocess (5.1.0)
logger (~> 1.5)
concurrent-ruby (1.3.5)
connection_pool (2.5.3)
crass (1.0.6)
date (3.4.1)
drb (2.2.3)
erb (5.0.1)
erubi (1.13.1)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-console (0.8.0)
irb (1.15.2)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
logger (1.7.0)
loofah (2.24.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.4)
mini_mime (1.1.5)
minitest (5.25.5)
net-imap (0.5.9)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4)
nokogiri (1.18.8-arm64-darwin)
racc (~> 1.4)
pg (1.5.9)
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
psych (5.2.6)
date
stringio
racc (1.8.1)
rack (3.1.16)
rack-session (2.1.1)
base64 (>= 0.1.0)
rack (>= 3.0.0)
rack-test (2.2.0)
rack (>= 1.3)
rackup (2.2.1)
rack (>= 3)
rails (7.2.2.1)
actioncable (= 7.2.2.1)
actionmailbox (= 7.2.2.1)
actionmailer (= 7.2.2.1)
actionpack (= 7.2.2.1)
actiontext (= 7.2.2.1)
actionview (= 7.2.2.1)
activejob (= 7.2.2.1)
activemodel (= 7.2.2.1)
activerecord (= 7.2.2.1)
activestorage (= 7.2.2.1)
activesupport (= 7.2.2.1)
bundler (>= 1.15.0)
railties (= 7.2.2.1)
rails-dom-testing (2.3.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (7.2.2.1)
actionpack (= 7.2.2.1)
activesupport (= 7.2.2.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.3.0)
rdoc (6.14.2)
erb
psych (>= 4.0.0)
reline (0.6.1)
io-console (~> 0.5)
securerandom (0.4.1)
stringio (3.1.7)
thor (1.3.2)
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
useragent (0.16.11)
websocket-driver (0.8.0)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.7.3)
PLATFORMS
arm64-darwin-24
DEPENDENCIES
benchmark-ips
childprocess
pg
rails
rails_event_store!
ruby_event_store!
ruby_event_store-active_record!
BUNDLED WITH
2.6.9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment