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

OneEvent isn't always empty #2565

Merged
merged 1 commit into from
Aug 15, 2019
Merged

OneEvent isn't always empty #2565

merged 1 commit into from
Aug 15, 2019

Conversation

ganmacs
Copy link
Member

@ganmacs ganmacs commented Aug 15, 2019

Signed-off-by: Yuta Iwama [email protected]

Which issue(s) this PR fixes:
Fixes #

What this PR does / why we need it:

require 'benchmark/ips'

class A
  def empty?
    size == 0
  end
end

class B < A
  def size
    1
  end
end

class C < A
  def empty?
    false
  end
end


b = B.new
c = C.new

Benchmark.ips do |x|
  x.report("b") do
    b.empty?
  end

  x.report("c") do
    c.empty?
  end
end
Warming up --------------------------------------
                   b   437.425k i/100ms
                   c   454.017k i/100ms
Calculating -------------------------------------
                   b     16.370M (± 6.5%) i/s -     81.798M in   5.021556s
                   c     22.938M (± 3.4%) i/s -    114.866M in   5.013438s

Docs Changes:

no need

Release Note:

same as title

@ganmacs ganmacs changed the title OneEvent is always not empty OneEvent isn't always empty Aug 15, 2019
@ganmacs ganmacs added the enhancement Feature request or improve operations label Aug 15, 2019
@repeatedly repeatedly merged commit 35438cd into fluent:master Aug 15, 2019
@repeatedly
Copy link
Member

Good catch!

@ganmacs ganmacs deleted the define-empty branch August 16, 2019 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or improve operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants