Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logger slower than MRI #1567

Closed
nirvdrum opened this issue Mar 17, 2014 · 3 comments
Closed

Logger slower than MRI #1567

nirvdrum opened this issue Mar 17, 2014 · 3 comments

Comments

@nirvdrum
Copy link
Contributor

I was trying to measure logging overhead for Cassandra client gem recently and decided to compare the closest thing I could get to a no-op logger in JRuby and MRI.

Code:

require 'benchmark/ips'
require 'logger'

logger = ::Logger.new('/dev/null')

Benchmark.ips do |x|
  x.report('debug') { logger.debug {} }
end

JRuby 1.7.11:

Ruby 1.7.11

Calculating -------------------------------------
              debug      2312 i/100ms
-------------------------------------------------
              debug      30308.9 (±3.9%) i/s -     152592 in   5.043000s

MRI 2.1.1:

MRI 2.1.1

Calculating -------------------------------------
              debug     6342 i/100ms
-------------------------------------------------
              debug     67615.3 (±2.8%) i/s -     342468 in   5.069185s

While not the most scientific way to compare, MRI is roughly twice as fast as JRuby. I haven't profiled anything yet. I just wanted to file this for now so it doesn't get lost.

@kwando
Copy link

kwando commented Mar 17, 2014

I tried to reproduce your results, but on my machine jruby is faster than MRI.

Late 2013 MPB 2,8GHz i7, 16GB RAM

jruby 1.7.11 (2.0.0p195) 2014-02-24 86339bb on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [darwin-x86_64]

Calculating -------------------------------------
               debug     12244 i/100ms
-------------------------------------------------
               debug   131705.6 (±3.6%) i/s -     661176 in   5.027000s

ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]

Calculating -------------------------------------
               debug      9153 i/100ms
-------------------------------------------------
               debug    97486.6 (±1.8%) i/s -     494262 in   5.071693s

@nirvdrum
Copy link
Contributor Author

Interesting. I'm running an Ubuntu 13.10 derivative. I'm also on 1.7.0_51, but I doubt that would matter much.

@enebo enebo added this to the Invalid or Duplicate milestone Feb 17, 2017
@enebo
Copy link
Member

enebo commented Feb 17, 2017

One both MacOS and Fedora25 I see MRI about 15% faster than us but definitely not 2x slower. I am using Java 8 though. I know we tried to figure this out but your env seems like an anomoly in this report (although I would have loved it if we had been able to figure this out).

@enebo enebo closed this as completed Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants