ruby SQL与ActiveRecord基准测试(订阅者)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby SQL与ActiveRecord基准测试(订阅者)相关的知识,希望对你有一定的参考价值。

# 100_000 users
# Rehearsal ---------------------------------------------------
# SQL Conditional   3.910000   0.060000   3.970000 (  3.991377)
#  AR Conditional   4.930000   0.050000   4.980000 (  4.971518)
# ------------------------------------------ total: 8.950000sec
# 
#                       user     system      total        real
# SQL Conditional   3.760000   0.030000   3.790000 (  3.800231)
#  AR Conditional   4.910000   0.040000   4.950000 (  4.957218)
# 
# All (2_478_408) users
# Rehearsal ---------------------------------------------------
# SQL Conditional   3.490000   0.030000   3.520000 (  3.522121)
#  AR Conditional   2.160000   0.020000   2.180000 (  2.175041)
# ------------------------------------------ total: 5.700000sec
# 
#                       user     system      total        real
# SQL Conditional   3.550000   0.030000   3.580000 (  3.576787)
#  AR Conditional   2.150000   0.020000   2.170000 (  2.166847)

=> [#<Benchmark::Tms:0x007fd2426b9588
  @cstime=0.0,
  @cutime=0.0,
  @label="SQL Conditional",
  @real=3.576787060999777,
  @stime=0.030000000000000027,
  @total=3.580000000000001,
  @utime=3.5500000000000007>,
 #<Benchmark::Tms:0x007fd24efb65d0
  @cstime=0.0,
  @cutime=0.0,
  @label=" AR Conditional",
  @real=2.1668473320023622,
  @stime=0.020000000000000018,
  @total=2.170000000000002,
  @utime=2.150000000000002>]

以上是关于ruby SQL与ActiveRecord基准测试(订阅者)的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Ruby on Rails 中查看给定 ActiveRecord 查询将生成的 SQL

您如何从 Ruby 直接将 SQL 与 MySQL 对话?

Ruby On Rails 中的编组与 ActiveRecord 序列化

ruby Gett媒体基准测试

ruby 将Mongoid / MongoDB数据库迁移到基于ActiveRecord的SQL数据库。一种转换架构的方法,另一种转换数据的方法。应对

解读 ruby​​ 的基准测试结果:Benchmark.bm 和 Benchmark.bmbm 的区别