Skip to content

Instantly share code, notes, and snippets.

@enebo
Last active May 17, 2022 00:39
Show Gist options
  • Save enebo/c57839e92529ef2b36924bcb5dc61d13 to your computer and use it in GitHub Desktop.
Save enebo/c57839e92529ef2b36924bcb5dc61d13 to your computer and use it in GitHub Desktop.
MRI
system ~/work/gems/activerecord-jdbc-adapter/bench master 1160% RAILS_ENV=production AR_ADAPTER=sqlite3 mri31 benchmark_selects.rb
--- Using AR from /home/enebo/work/gems/activerecord-jdbc-adapter/../rails/activerecord/lib
--- RUBY_VERSION: 3.1.0
--- ActiveRecord: 7.0.2.4
- BenchRecord.connection.drop_table(:bench_records) took 0.014703474
- BenchRecord.connection.create_table(:bench_records) { ... } took 0.003116773
- BenchRecord.create!(...) [1000x] took 3.550466486
Warming up --------------------------------------
BenchRecord.select('a_binary').where(id: i).first
557.000 i/100ms
BenchRecord.select('a_boolean').where(id: i).first
518.000 i/100ms
BenchRecord.select('a_date').where(id: i).first
500.000 i/100ms
BenchRecord.select('a_datetime').where(id: i).first
570.000 i/100ms
BenchRecord.select('a_decimal').where(id: i).first
543.000 i/100ms
BenchRecord.select('a_float').where(id: i).first
574.000 i/100ms
BenchRecord.select('a_integer').where(id: i).first
577.000 i/100ms
BenchRecord.select('a_string').where(id: i).first
568.000 i/100ms
BenchRecord.select('a_text').where(id: i).first
567.000 i/100ms
BenchRecord.select('a_time').where(id: i).first
552.000 i/100ms
BenchRecord.select('a_timestamp').where(id: i).first
574.000 i/100ms
BenchRecord.select('*').where(id: i).first
456.000 i/100ms
BenchRecord.select('a_binary').where(['id = ?', an_id]).first
486.000 i/100ms
BenchRecord.select('a_boolean').where(['id = ?', an_id]).first
454.000 i/100ms
BenchRecord.select('a_date').where(['id = ?', an_id]).first
446.000 i/100ms
BenchRecord.select('a_datetime').where(['id = ?', an_id]).first
453.000 i/100ms
BenchRecord.select('a_decimal').where(['id = ?', an_id]).first
457.000 i/100ms
BenchRecord.select('a_float').where(['id = ?', an_id]).first
446.000 i/100ms
BenchRecord.select('a_integer').where(['id = ?', an_id]).first
465.000 i/100ms
BenchRecord.select('a_string').where(['id = ?', an_id]).first
450.000 i/100ms
BenchRecord.select('a_text').where(['id = ?', an_id]).first
447.000 i/100ms
BenchRecord.select('a_time').where(['id = ?', an_id]).first
453.000 i/100ms
BenchRecord.select('a_timestamp').where(['id = ?', an_id]).first
455.000 i/100ms
BenchRecord.select('*').where(['id = ?', an_id]).first
373.000 i/100ms
Calculating -------------------------------------
BenchRecord.select('a_binary').where(id: i).first
4.651k (± 3.5%) i/s - 23.394k in 5.036301s
BenchRecord.select('a_boolean').where(id: i).first
4.720k (± 2.1%) i/s - 23.828k in 5.050860s
BenchRecord.select('a_date').where(id: i).first
4.710k (± 2.2%) i/s - 24.000k in 5.097771s
BenchRecord.select('a_datetime').where(id: i).first
4.727k (± 2.2%) i/s - 23.940k in 5.066947s
BenchRecord.select('a_decimal').where(id: i).first
4.732k (± 2.3%) i/s - 23.892k in 5.052054s
BenchRecord.select('a_float').where(id: i).first
4.709k (± 2.4%) i/s - 23.534k in 5.000334s
BenchRecord.select('a_integer').where(id: i).first
4.705k (± 2.3%) i/s - 23.657k in 5.031193s
BenchRecord.select('a_string').where(id: i).first
4.612k (± 7.5%) i/s - 23.288k in 5.083448s
BenchRecord.select('a_text').where(id: i).first
4.378k (± 4.9%) i/s - 22.113k in 5.063251s
BenchRecord.select('a_time').where(id: i).first
4.396k (± 4.5%) i/s - 22.080k in 5.032398s
BenchRecord.select('a_timestamp').where(id: i).first
4.352k (± 6.4%) i/s - 21.812k in 5.035023s
BenchRecord.select('*').where(id: i).first
3.609k (± 7.2%) i/s - 18.240k in 5.082689s
BenchRecord.select('a_binary').where(['id = ?', an_id]).first
4.378k (± 5.4%) i/s - 21.870k in 5.011142s
BenchRecord.select('a_boolean').where(['id = ?', an_id]).first
4.429k (± 4.7%) i/s - 22.246k in 5.034489s
BenchRecord.select('a_date').where(['id = ?', an_id]).first
4.192k (± 6.5%) i/s - 20.962k in 5.022204s
BenchRecord.select('a_datetime').where(['id = ?', an_id]).first
4.532k (± 2.3%) i/s - 22.650k in 5.001098s
BenchRecord.select('a_decimal').where(['id = ?', an_id]).first
4.460k (± 2.7%) i/s - 22.393k in 5.024292s
BenchRecord.select('a_float').where(['id = ?', an_id]).first
4.295k (± 4.0%) i/s - 21.854k in 5.096816s
BenchRecord.select('a_integer').where(['id = ?', an_id]).first
4.275k (± 3.8%) i/s - 21.390k in 5.011357s
BenchRecord.select('a_string').where(['id = ?', an_id]).first
4.295k (± 5.2%) i/s - 21.600k in 5.043002s
BenchRecord.select('a_text').where(['id = ?', an_id]).first
4.496k (± 2.4%) i/s - 22.797k in 5.073923s
BenchRecord.select('a_time').where(['id = ?', an_id]).first
4.519k (± 2.3%) i/s - 22.650k in 5.014563s
BenchRecord.select('a_timestamp').where(['id = ?', an_id]).first
4.532k (± 2.5%) i/s - 22.750k in 5.023529s
BenchRecord.select('*').where(['id = ?', an_id]).first
3.979k (± 2.5%) i/s - 20.142k in 5.064904s
JRuby
system ~/work/gems/activerecord-jdbc-adapter/bench master * 1160% RAILS_ENV=production AR_ADAPTER=sqlite3 jruby -Xcompile.invokedynamic benchmark_selects.rb
--- Using AR from /home/enebo/work/gems/activerecord-jdbc-adapter/../rails/activerecord/lib
SEND.N: gem
Ignoring bootsnap-1.11.1 because its extensions are not built. Try: gem pristine bootsnap --version 1.11.1
SEND.N: alias_method
Ignoring digest-crc-0.6.4 because its extensions are not built. Try: gem pristine digest-crc --version 0.6.4
SEND.N: gem
SEND.N: gem
SEND.N: alias_method
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
pSEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: public
SEND.N: _define_after_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: public
--- RUBY_VERSION: 3.1.0 (JRUBY_VERSION: 9.4.0.0-SNAPSHOT 17.0.1+12)
--- ActiveRecord: 7.0.2.4 (AR-JDBC: 70.0.pre e3a11f3a)
SEND.N: public
SEND.N: public
SEND.N: gem
- BenchRecord.connection.drop_table(:bench_records) took 0.007568
- BenchRecord.connection.create_table(:bench_records) { ... } took 0.014098999999999999
SEND.N: define_method_attribute
SEND.N: define_method_attribute=
SEND.N: define_method_attribute
SEND.N: define_method_attribute=
SEND.N: define_method_attribute
SEND.N: define_method_attribute=
SEND.N: define_method_attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_ValuesList
SEND.N: visit_ActiveModel_Attribute_FromUser
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_ValuesList
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_ValuesList
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_ValuesList
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
- BenchRecord.create!(...) [1000x] took 8.344498
SEND.N: public
Warming up --------------------------------------
BenchRecord.select('a_binary').where(id: i).first
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_SelectStatement
8.000 i/100ms
BenchRecord.select('a_boolean').where(id: i).first
37.000 i/100ms
BenchRecord.select('a_date').where(id: i).first
70.000 i/100ms
BenchRecord.select('a_datetime').where(id: i).first
79.000 i/100ms
BenchRecord.select('a_decimal').where(id: i).first
79.000 i/100ms
BenchRecord.select('a_float').where(id: i).first
94.000 i/100ms
BenchRecord.select('a_integer').where(id: i).first
102.000 i/100ms
BenchRecord.select('a_string').where(id: i).first
168.000 i/100ms
BenchRecord.select('a_text').where(id: i).first
605.000 i/100ms
BenchRecord.select('a_time').where(id: i).first
644.000 i/100ms
BenchRecord.select('a_timestamp').where(id: i).first
458.000 i/100ms
BenchRecord.select('*').where(id: i).first
SEND.N: visit_Arel_Nodes_JoinSource
205.000 i/100ms
BenchRecord.select('a_binary').where(['id = ?', an_id]).first
SEND.N: visit_Arel_Nodes_SelectStatement
40.000 i/100ms
BenchRecord.select('a_boolean').where(['id = ?', an_id]).first
67.000 i/100ms
BenchRecord.select('a_date').where(['id = ?', an_id]).first
136.000 i/100ms
BenchRecord.select('a_datetime').where(['id = ?', an_id]).first
310.000 i/100ms
BenchRecord.select('a_decimal').where(['id = ?', an_id]).first
522.000 i/100ms
BenchRecord.select('a_float').where(['id = ?', an_id]).first
596.000 i/100ms
BenchRecord.select('a_integer').where(['id = ?', an_id]).first
641.000 i/100ms
BenchRecord.select('a_string').where(['id = ?', an_id]).first
687.000 i/100ms
BenchRecord.select('a_text').where(['id = ?', an_id]).first
662.000 i/100ms
BenchRecord.select('a_time').where(['id = ?', an_id]).first
680.000 i/100ms
BenchRecord.select('a_timestamp').where(['id = ?', an_id]).first
693.000 i/100ms
BenchRecord.select('*').where(['id = ?', an_id]).first
509.000 i/100ms
Calculating -------------------------------------
BenchRecord.select('a_binary').where(id: i).first
5.702k (±24.4%) i/s - 25.728k in 4.966452s
BenchRecord.select('a_boolean').where(id: i).first
6.533k (± 7.1%) i/s - 32.375k in 4.992075s
BenchRecord.select('a_date').where(id: i).first
6.390k (± 7.1%) i/s - 31.780k in 5.002479s
BenchRecord.select('a_datetime').where(id: i).first
6.480k (± 6.3%) i/s - 32.232k in 4.997098s
BenchRecord.select('a_decimal').where(id: i).first
6.483k (± 4.2%) i/s - 32.311k in 4.995099s
BenchRecord.select('a_float').where(id: i).first
6.518k (± 4.9%) i/s - 32.524k in 5.004011s
BenchRecord.select('a_integer').where(id: i).first
6.406k (± 5.4%) i/s - 31.926k in 4.998984s
BenchRecord.select('a_string').where(id: i).first
6.319k (± 7.2%) i/s - 31.416k in 5.000130s
BenchRecord.select('a_text').where(id: i).first
5.983k (± 5.9%) i/s - 30.250k in 5.075359s
BenchRecord.select('a_time').where(id: i).first
6.037k (± 5.4%) i/s - 30.268k in 5.028241s
BenchRecord.select('a_timestamp').where(id: i).first
6.275k (± 7.1%) i/s - 31.602k in 5.064094s
BenchRecord.select('*').where(id: i).first
4.875k (± 3.7%) i/s - 24.395k in 5.011241s
BenchRecord.select('a_binary').where(['id = ?', an_id]).first
6.938k (± 6.3%) i/s - 34.480k in 4.995312s
BenchRecord.select('a_boolean').where(['id = ?', an_id]).first
6.616k (± 9.0%) i/s - 32.763k in 5.000346s
BenchRecord.select('a_date').where(['id = ?', an_id]).first
6.758k (± 7.9%) i/s - 33.592k in 5.008937s
BenchRecord.select('a_datetime').where(['id = ?', an_id]).first
7.026k (± 2.8%) i/s - 35.340k in 5.034241s
BenchRecord.select('a_decimal').where(['id = ?', an_id]).first
6.852k (± 3.9%) i/s - 34.452k in 5.035961s
BenchRecord.select('a_float').where(['id = ?', an_id]).first
7.077k (± 3.2%) i/s - 35.760k in 5.058201s
BenchRecord.select('a_integer').where(['id = ?', an_id]).first
6.648k (± 5.9%) i/s - 33.332k in 5.034610s
BenchRecord.select('a_string').where(['id = ?', an_id]).first
6.866k (± 4.1%) i/s - 34.350k in 5.012314s
BenchRecord.select('a_text').where(['id = ?', an_id]).first
7.062k (± 3.1%) i/s - 35.748k in 5.067638s
BenchRecord.select('a_time').where(['id = ?', an_id]).first
6.922k (± 4.0%) i/s - 34.680k in 5.018913s
BenchRecord.select('a_timestamp').where(['id = ?', an_id]).first
6.845k (± 5.0%) i/s - 34.650k in 5.076259s
BenchRecord.select('*').where(['id = ?', an_id]).first
5.116k (± 3.4%) i/s - 25.959k in 5.080293s
system ~/work/gems/activerecord-jdbc-adapter/bench master * 1161%
system ~/work/gems/activerecord-jdbc-adapter/bench master * 1162% RAILS_ENV=production AR_ADAPTER=sqlite3 mri31 benchmark_update.rb
--- Using AR from /home/enebo/work/gems/activerecord-jdbc-adapter/../rails/activerecord/lib
--- RUBY_VERSION: 3.1.0
--- ActiveRecord: 7.0.2.4
- BenchRecord.connection.drop_table(:bench_records) took 0.007670902
- BenchRecord.connection.create_table(:bench_records) { ... } took 0.001901143
Warming up --------------------------------------
BenchRecord#update() 34.000 i/100ms
BenchRecord#update('a_binary' => "\xAE0\xE1\x9A\x9E\xE9[\xCE\x0E\x0F\x05\x9F\x03\xA0\xDDQ...(1536)")
13.000 i/100ms
BenchRecord#update('a_boolean' => true)
13.000 i/100ms
BenchRecord#update('a_date' => Mon, 16 May 2022)
19.000 i/100ms
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:15:04 -0500)
16.000 i/100ms
BenchRecord#update('a_decimal' => 0.123456789055555e10)
10.000 i/100ms
BenchRecord#update('a_float' => 999.99)
15.000 i/100ms
BenchRecord#update('a_integer' => 4242)
15.000 i/100ms
BenchRecord#update('a_string' => "BORAT Ipsum!")
15.000 i/100ms
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
20.000 i/100ms
BenchRecord#update('a_time' => 2022-05-16 19:15:04.687562722 -0500)
18.000 i/100ms
BenchRecord#update('a_timestamp' => 2022-05-16 19:15:04.68756686 -0500)
15.000 i/100ms
BenchRecord#update(...)
17.000 i/100ms
Calculating -------------------------------------
BenchRecord#update() 304.800 (±18.0%) i/s - 1.496k in 5.087317s
BenchRecord#update('a_binary' => "\xAE0\xE1\x9A\x9E\xE9[\xCE\x0E\x0F\x05\x9F\x03\xA0\xDDQ...(1536)")
150.128 (±21.3%) i/s - 728.000 in 5.056697s
BenchRecord#update('a_boolean' => true)
169.536 (±19.5%) i/s - 819.000 in 5.053959s
BenchRecord#update('a_date' => Mon, 16 May 2022)
71.342 (±105.1%) i/s - 190.000 in 5.244602s
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:15:04 -0500)
110.536 (±60.6%) i/s - 320.000 in 5.029750s
BenchRecord#update('a_decimal' => 0.123456789055555e10)
158.516 (±16.4%) i/s - 770.000 in 5.002272s
BenchRecord#update('a_float' => 999.99)
162.989 (±20.2%) i/s - 780.000 in 5.014580s
BenchRecord#update('a_integer' => 4242)
167.956 (±18.5%) i/s - 810.000 in 5.009717s
BenchRecord#update('a_string' => "BORAT Ipsum!")
158.458 (±21.5%) i/s - 765.000 in 5.084061s
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
148.621 (±20.2%) i/s - 720.000 in 5.036608s
BenchRecord#update('a_time' => 2022-05-16 19:15:04.687562722 -0500)
152.002 (±19.1%) i/s - 738.000 in 5.025935s
BenchRecord#update('a_timestamp' => 2022-05-16 19:15:04.68756686 -0500)
154.572 (±18.1%) i/s - 765.000 in 5.116772s
BenchRecord#update(...)
131.728 (±18.2%) i/s - 646.000 in 5.076637s
system ~/work/gems/activerecord-jdbc-adapter/bench master * 1162% RAILS_ENV=production AR_ADAPTER=sqlite3 jruby -Xcompile.invokedynamic benchmark_update.rb
--- Using AR from /home/enebo/work/gems/activerecord-jdbc-adapter/../rails/activerecord/lib
SEND.N: gem
Ignoring bootsnap-1.11.1 because its extensions are not built. Try: gem pristine bootsnap --version 1.11.1
SEND.N: alias_method
Ignoring digest-crc-0.6.4 because its extensions are not built. Try: gem pristine digest-crc --version 0.6.4
SEND.N: gem
SEND.N: gem
SEND.N: alias_method
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: public
SEND.N: public
SEND.N: _define_after_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: public
SEND.N: public
--- RUBY_VERSION: 3.1.0 (JRUBY_VERSION: 9.4.0.0-SNAPSHOT 17.0.1+12)
--- ActiveRecord: 7.0.2.4 (AR-JDBC: 70.0.pre e3a11f3a)
SEND.N: public
SEND.N: public
SEND.N: gem
- BenchRecord.connection.drop_table(:bench_records) took 0.014478
- BenchRecord.connection.create_table(:bench_records) { ... } took 0.014074
Warming up --------------------------------------
BenchRecord#update()SEND.N: define_method_attribute
SEND.N: define_method_attribute=
SEND.N: define_method_attribute
SEND.N: define_method_attribute=
SEND.N: define_method_attribute
SEND.N: define_method_attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_Arel_Nodes_JoinSource
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_Equality
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_ActiveRecord_Relation_QueryAttribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_Limit
SEND.N: visit_ActiveModel_Attribute_WithCastValue
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_Arel_Nodes_JoinSource
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_Equality
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_Limit
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_Arel_Nodes_JoinSource
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_Equality
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_Limit
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_Arel_Nodes_JoinSource
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_Equality
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_Limit
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_InsertStatement
2.000 i/100ms
BenchRecord#update('a_binary' => "a\xAA\r(\xE5\xA1\eY\xEE*\b\x9F\x91\xDD\xCE[...(1536)")
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_UpdateStatement
SEND.N: visit_Arel_Nodes_SelectStatement
3.000 i/100ms
BenchRecord#update('a_boolean' => true)
5.000 i/100ms
BenchRecord#update('a_date' => Mon, 16 May 2022)
7.000 i/100ms
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:18:11 -0500)
5.000 i/100ms
BenchRecord#update('a_decimal' => 0.123456789055555e10)
7.000 i/100ms
BenchRecord#update('a_float' => 999.99)
7.000 i/100ms
BenchRecord#update('a_integer' => 4242)
8.000 i/100ms
BenchRecord#update('a_string' => "BORAT Ipsum!")
9.000 i/100ms
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
8.000 i/100ms
BenchRecord#update('a_time' => 2022-05-16 19:18:11.218848 -0500)
8.000 i/100ms
BenchRecord#update('a_timestamp' => 2022-05-16 19:18:11.219895 -0500)
7.000 i/100ms
BenchRecord#update(...)
7.000 i/100ms
Calculating -------------------------------------
BenchRecord#update() 160.646 (±17.4%) i/s - 756.000 in 5.047012s
BenchRecord#update('a_binary' => "a\xAA\r(\xE5\xA1\eY\xEE*\b\x9F\x91\xDD\xCE[...(1536)")
17.989 (±11.1%) i/s - 90.000 in 5.048887s
BenchRecord#update('a_boolean' => true)
77.452 (±54.2%) i/s - 215.000 in 5.019654s
BenchRecord#update('a_date' => Mon, 16 May 2022)
105.350 (±12.3%) i/s - 518.000 in 5.001030s
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:18:11 -0500)
106.093 (±17.0%) i/s - 515.000 in 5.041472s
BenchRecord#update('a_decimal' => 0.123456789055555e10)
91.389 (±20.8%) i/s - 441.000 in 5.034414s
BenchRecord#update('a_float' => 999.99)
101.273 (±17.8%) i/s - 490.000 in 5.017809s
BenchRecord#update('a_integer' => 4242)
89.069 (±21.3%) i/s - 432.000 in 5.061085s
BenchRecord#update('a_string' => "BORAT Ipsum!")
103.586 (±20.3%) i/s - 504.000 in 5.079996s
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
110.568 (±16.3%) i/s - 536.000 in 5.006974s
BenchRecord#update('a_time' => 2022-05-16 19:18:11.218848 -0500)
104.232 (±19.2%) i/s - 504.000 in 5.028952s
BenchRecord#update('a_timestamp' => 2022-05-16 19:18:11.219895 -0500)
100.283 (±23.9%) i/s - 476.000 in 5.029936s
BenchRecord#update(...)
103.237 (±23.2%) i/s - 483.000 in 4.997963s
system ~/work/gems/activerecord-jdbc-adapter/bench master * 1163%
# frozen_string_literal: false
require File.expand_path('record', File.dirname(__FILE__))
fields = {
'a_binary' => Random.new.bytes(1024) + Random.new.bytes(512),
'a_boolean' => true,
'a_date' => Date.today,
'a_datetime' => Time.now.to_datetime,
'a_decimal' => BigDecimal('1234567890.55555'),
'a_float' => 999.99,
'a_integer' => 4242,
'a_string' => 'BORAT Ipsum!',
'a_text' => 'Kazakhstan is the greatest country in the world. ' <<
'All other countries are run by little girls. ' <<
'Kazakhstan is number one exporter of potassium. ' <<
'Other Central Asian countries have inferior potassium. ' <<
'Kazakhstan is the greatest country in the world. ' <<
'All other countries is the home of the gays.' <<
"\n\n" <<
'In Kazakhstan, it is illegal for more than five woman to be in ' <<
'the same place except for in brothel or in grave. ' <<
'In US and A, many womens meet in a groups called feminists.',
'a_time' => Time.now.to_time,
'a_timestamp' => Time.now
}
empty = {}
Benchmark.ips do |x|
x.config(:suite => BenchTestHelper::Suite::INSTANCE)
record = BenchRecord.create.reload
# x.report("BenchRecord#update()") do
# record.update empty
# end
fields.each do |field, value|
label = value
label = "#{value[0,16]}...(#{value.size})" if value.is_a?(String) && value.size > 16
record = BenchRecord.create.reload
x.report("BenchRecord#update('#{field}' => #{label.inspect})") do
record.send(field + "=", value)
# record.update(field => value)
record.save!
end
end
# x.report("BenchRecord#update(...)") do
# record.update(fields)
# end
end
puts "\n"
system ~/work/gems/activerecord-jdbc-adapter/bench master * 1166% RAILS_ENV=production AR_ADAPTER=sqlite3 mri31 benchmark_update.rb
--- Using AR from /home/enebo/work/gems/activerecord-jdbc-adapter/../rails/activerecord/lib
--- RUBY_VERSION: 3.1.0
--- ActiveRecord: 7.0.2.4
- BenchRecord.connection.drop_table(:bench_records) took 0.0289521
- BenchRecord.connection.create_table(:bench_records) { ... } took 0.002563612
Warming up --------------------------------------
BenchRecord#update('a_binary' => "+\xE8d\xDB[\xB6\xDEP\x85\xB2\xE7t\x85 *....(1536)")
121.232k i/100ms
BenchRecord#update('a_boolean' => true)
123.366k i/100ms
BenchRecord#update('a_date' => Mon, 16 May 2022)
106.120k i/100ms
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:33:26 -0500)
105.848k i/100ms
BenchRecord#update('a_decimal' => 0.123456789055555e10)
118.221k i/100ms
BenchRecord#update('a_float' => 999.99)
125.876k i/100ms
BenchRecord#update('a_integer' => 4242)
122.427k i/100ms
BenchRecord#update('a_string' => "BORAT Ipsum!")
117.361k i/100ms
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
121.735k i/100ms
BenchRecord#update('a_time' => 2022-05-16 19:33:26.964697652 -0500)
101.334k i/100ms
BenchRecord#update('a_timestamp' => 2022-05-16 19:33:26.964704264 -0500)
101.922k i/100ms
Calculating -------------------------------------
BenchRecord#update('a_binary' => "+\xE8d\xDB[\xB6\xDEP\x85\xB2\xE7t\x85 *....(1536)")
1.106M (± 7.0%) i/s - 5.577M in 5.071239s
BenchRecord#update('a_boolean' => true)
963.716k (± 2.5%) i/s - 4.935M in 5.123706s
BenchRecord#update('a_date' => Mon, 16 May 2022)
853.734k (± 1.8%) i/s - 4.351M in 5.097977s
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:33:26 -0500)
847.844k (± 1.9%) i/s - 4.340M in 5.120496s
BenchRecord#update('a_decimal' => 0.123456789055555e10)
979.440k (± 2.7%) i/s - 4.965M in 5.073465s
BenchRecord#update('a_float' => 999.99)
1.003M (± 2.0%) i/s - 5.035M in 5.023023s
BenchRecord#update('a_integer' => 4242)
1.005M (± 2.0%) i/s - 5.142M in 5.117466s
BenchRecord#update('a_string' => "BORAT Ipsum!")
949.704k (± 2.0%) i/s - 4.812M in 5.068762s
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
968.560k (± 4.2%) i/s - 4.869M in 5.037108s
BenchRecord#update('a_time' => 2022-05-16 19:33:26.964697652 -0500)
761.346k (±10.3%) i/s - 3.851M in 5.110260s
BenchRecord#update('a_timestamp' => 2022-05-16 19:33:26.964704264 -0500)
864.535k (± 2.5%) i/s - 4.383M in 5.072774s
system ~/work/gems/activerecord-jdbc-adapter/bench master * 1167% RAILS_ENV=production AR_ADAPTER=sqlite3 mri31 benchmark_update.rb
--- Using AR from /home/enebo/work/gems/activerecord-jdbc-adapter/../rails/activerecord/lib
--- RUBY_VERSION: 3.1.0
--- ActiveRecord: 7.0.2.4
- BenchRecord.connection.drop_table(:bench_records) took 0.007143284
- BenchRecord.connection.create_table(:bench_records) { ... } took 0.002122368
Warming up --------------------------------------
BenchRecord#update('a_binary' => "`\x1E6\xCF\xE9=\x88W\xDB(\x7F\xC0A\xD5\xB7\xA7...(1536)")
1.091k i/100ms
BenchRecord#update('a_boolean' => true)
1.026k i/100ms
BenchRecord#update('a_date' => Mon, 16 May 2022)
1.042k i/100ms
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:35:18 -0500)
781.000 i/100ms
BenchRecord#update('a_decimal' => 0.123456789055555e10)
885.000 i/100ms
BenchRecord#update('a_float' => 999.99)
905.000 i/100ms
BenchRecord#update('a_integer' => 4242)
886.000 i/100ms
BenchRecord#update('a_string' => "BORAT Ipsum!")
962.000 i/100ms
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
942.000 i/100ms
BenchRecord#update('a_time' => 2022-05-16 19:35:18.055516962 -0500)
899.000 i/100ms
BenchRecord#update('a_timestamp' => 2022-05-16 19:35:18.055521996 -0500)
793.000 i/100ms
Calculating -------------------------------------
BenchRecord#update('a_binary' => "`\x1E6\xCF\xE9=\x88W\xDB(\x7F\xC0A\xD5\xB7\xA7...(1536)")
7.567k (± 2.4%) i/s - 38.185k in 5.049113s
BenchRecord#update('a_boolean' => true)
7.678k (± 2.2%) i/s - 38.988k in 5.080444s
BenchRecord#update('a_date' => Mon, 16 May 2022)
7.520k (± 1.8%) i/s - 38.554k in 5.128249s
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:35:18 -0500)
5.917k (± 3.1%) i/s - 29.678k in 5.020721s
BenchRecord#update('a_decimal' => 0.123456789055555e10)
6.964k (± 2.9%) i/s - 35.400k in 5.088105s
BenchRecord#update('a_float' => 999.99)
7.234k (± 3.1%) i/s - 36.200k in 5.009198s
BenchRecord#update('a_integer' => 4242)
7.285k (± 3.7%) i/s - 37.212k in 5.115075s
BenchRecord#update('a_string' => "BORAT Ipsum!")
6.691k (±10.1%) i/s - 33.670k in 5.089807s
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
6.162k (±17.6%) i/s - 30.144k in 5.061469s
BenchRecord#update('a_time' => 2022-05-16 19:35:18.055516962 -0500)
6.711k (± 5.3%) i/s - 34.162k in 5.105188s
BenchRecord#update('a_timestamp' => 2022-05-16 19:35:18.055521996 -0500)
6.942k (± 4.6%) i/s - 34.892k in 5.037512s
system ~/work/gems/activerecord-jdbc-adapter/bench master * 1167% RAILS_ENV=production AR_ADAPTER=sqlite3 jruby -Xcompile.invokedynamic benchmark_update.rb
--- Using AR from /home/enebo/work/gems/activerecord-jdbc-adapter/../rails/activerecord/lib
SEND.N: gem
Ignoring bootsnap-1.11.1 because its extensions are not built. Try: gem pristine bootsnap --version 1.11.1
SEND.N: alias_method
Ignoring digest-crc-0.6.4 because its extensions are not built. Try: gem pristine digest-crc --version 0.6.4
SEND.N: gem
SEND.N: gem
SEND.N: alias_method
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: gem
SEND.N: public
SEND.N: _define_after_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: _define_before_model_callback
SEND.N: _define_around_model_callback
SEND.N: _define_after_model_callback
SEND.N: public
--- RUBY_VERSION: 3.1.0 (JRUBY_VERSION: 9.4.0.0-SNAPSHOT 17.0.1+12)
--- ActiveRecord: 7.0.2.4 (AR-JDBC: 70.0.pre e3a11f3a)
SEND.N: public
SEND.N: public
SEND.N: gem
- BenchRecord.connection.drop_table(:bench_records) took 0.004757
- BenchRecord.connection.create_table(:bench_records) { ... } took 0.013115
SEND.N: define_method_attribute
SEND.N: define_method_attribute=
SEND.N: define_method_attribute
SEND.N: define_method_attribute=
SEND.N: define_method_attribute
SEND.N: define_method_attribute=
SEND.N: define_method_attribute
SEND.N: define_method_attribute=
SEND.N: define_method_attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_Arel_Nodes_JoinSource
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_Equality
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_ActiveRecord_Relation_QueryAttribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_Limit
SEND.N: visit_ActiveModel_Attribute_WithCastValue
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_Arel_Nodes_JoinSource
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_Equality
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_Limit
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_Arel_Nodes_JoinSource
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_Equality
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_Limit
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_Arel_Nodes_JoinSource
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_Equality
SEND.N: visit_Arel_Attributes_Attribute
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_Limit
SEND.N: visit_ActiveModel_Attribute
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Table
SEND.N: visit_Arel_Nodes_SqlLiteral
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_InsertStatement
SEND.N: visit_Arel_Nodes_SelectStatement
SEND.N: visit_Arel_Nodes_InsertStatement
Warming up --------------------------------------
BenchRecord#update('a_binary' => "\xF9\x80\x9B\x8F\xAA|\x96\xDBA\xC8P\xB7\x95K\xD6n...(1536)")
SEND.N: a_binary=
48.000 i/100ms
BenchRecord#update('a_boolean' => true)
SEND.N: visit_Arel_Nodes_UpdateStatement
SEND.N: a_boolean=
93.000 i/100ms
BenchRecord#update('a_date' => Mon, 16 May 2022)
SEND.N: visit_Arel_Nodes_UpdateStatement
SEND.N: a_date=
92.000 i/100ms
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:37:04 -0500)
SEND.N: a_datetime=
86.000 i/100ms
BenchRecord#update('a_decimal' => 0.123456789055555e10)
SEND.N: a_decimal=
78.000 i/100ms
BenchRecord#update('a_float' => 999.99)
SEND.N: a_float=
104.000 i/100ms
BenchRecord#update('a_integer' => 4242)
SEND.N: a_integer=
207.000 i/100ms
BenchRecord#update('a_string' => "BORAT Ipsum!")
SEND.N: a_string=
218.000 i/100ms
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
SEND.N: a_text=
344.000 i/100ms
BenchRecord#update('a_time' => 2022-05-16 19:37:04.493507 -0500)
SEND.N: a_time=
171.000 i/100ms
BenchRecord#update('a_timestamp' => 2022-05-16 19:37:04.493634 -0500)
SEND.N: a_timestamp=
386.000 i/100ms
Calculating -------------------------------------
BenchRecord#update('a_binary' => "\xF9\x80\x9B\x8F\xAA|\x96\xDBA\xC8P\xB7\x95K\xD6n...(1536)")
14.645k (±14.5%) i/s - 70.368k in 4.985778s
BenchRecord#update('a_boolean' => true)
14.941k (±10.9%) i/s - 73.005k in 4.994439s
BenchRecord#update('a_date' => Mon, 16 May 2022)
14.783k (±10.9%) i/s - 72.220k in 4.995867s
BenchRecord#update('a_datetime' => Mon, 16 May 2022 19:37:04 -0500)
11.736k (±18.5%) i/s - 55.212k in 4.998195s
BenchRecord#update('a_decimal' => 0.123456789055555e10)
12.776k (±11.6%) i/s - 62.400k in 4.995576s
BenchRecord#update('a_float' => 999.99)
12.823k (±13.0%) i/s - 62.608k in 4.997734s
BenchRecord#update('a_integer' => 4242)
13.852k (± 7.7%) i/s - 68.724k in 4.999806s
BenchRecord#update('a_string' => "BORAT Ipsum!")
14.151k (± 6.2%) i/s - 70.414k in 4.998127s
BenchRecord#update('a_text' => "Kazakhstan is th...(464)")
14.707k (± 6.3%) i/s - 73.272k in 5.008257s
BenchRecord#update('a_time' => 2022-05-16 19:37:04.493507 -0500)
14.482k (± 4.2%) i/s - 72.333k in 5.004369s
BenchRecord#update('a_timestamp' => 2022-05-16 19:37:04.493634 -0500)
13.912k (± 7.2%) i/s - 69.094k in 4.999790s
system ~/work/gems/activerecord-jdbc-adapter/bench master * 1168%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment