• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lotus / utils / 236
98%

Build:
DEFAULT BRANCH: master
Ran 22 Jan 2015 11:22PM UTC
Jobs 11
Files 12
Run time 20min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
236

Pull #52

travis-ci

weppos
Extract out common logic to prepare the callables

I benchmarked the results, and the change is justifiable. There is no substantial difference between a #callables that accepts a block and uses .each, and the current #callable version that uses .map and returns an array.

Comparing the following implementations:

    def append1(*callbacks, &block)
      callbacks.push block if block_given?
      callbacks.each do |c|
        @chain.push Factory.fabricate(c)
      end

      @chain.uniq!
    end

    def append2(*callbacks, &block)
      callables(callbacks, block) do |callable|
        @chain.push callable
      end

      @chain.uniq!
    end

Performance are equivalent. The 1.0x decrease is caused by the previous run and GC.

    ➜  lotus--utils git:(chain-append) ✗ ruby bm.rb
    Calculating -------------------------------------
                   push1    99.000  i/100ms
                   push2   109.000  i/100ms
    -------------------------------------------------
                   push1    398.513  (±18.1%) i/s -      1.980k
                   push2    389.637  (±20.5%) i/s -      1.962k

    Comparison:
                   push1:      398.5 i/s
                   push2:      389.6 i/s - 1.02x slower

    ➜  lotus--utils git:(chain-append) ✗ ruby bm.rb
    Calculating -------------------------------------
                   push2   101.000  i/100ms
                   push1   111.000  i/100ms
    -------------------------------------------------
                   push2    426.787  (±23.7%) i/s -      2.121k in   5.254565s
                   push1    400.473  (±20.2%) i/s -      1.998k

    Comparison:
                   push2:      426.8 i/s
                   push1:      400.5 i/s - 1.07x slower
Pull Request #52: Chain append/prepend

415 of 424 relevant lines covered (97.88%)

95.33 hits per line

Jobs
ID Job ID Ran Files Coverage
1 236.1 (2.0.0) 22 Jan 2015 11:22PM UTC 0
96.64
Travis Job 236.1
2 236.2 (2.1.0) 22 Jan 2015 11:23PM UTC 0
96.12
Travis Job 236.2
3 236.3 (2.1.1) 22 Jan 2015 11:24PM UTC 0
96.12
Travis Job 236.3
4 236.4 (2.1.2) 22 Jan 2015 11:22PM UTC 0
96.12
Travis Job 236.4
5 236.5 (2.1.3) 22 Jan 2015 11:23PM UTC 0
96.12
Travis Job 236.5
6 236.6 (2.1.4) 22 Jan 2015 11:29PM UTC 0
96.12
Travis Job 236.6
7 236.7 (2.1.5) 22 Jan 2015 11:29PM UTC 0
96.12
Travis Job 236.7
8 236.8 (2.2) 22 Jan 2015 11:30PM UTC 0
96.12
Travis Job 236.8
9 236.9 (rbx-2) 22 Jan 2015 11:32PM UTC 0
99.26
Travis Job 236.9
10 236.10 (jruby, JRUBY_OPTS="--2.0") 22 Jan 2015 11:32PM UTC 0
96.69
Travis Job 236.10
11 236.11 (jruby-head, JRUBY_OPTS="--2.1") 22 Jan 2015 11:43PM UTC 0
0.0
Travis Job 236.11
Source Files on build 236
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #236
  • Pull Request #52
  • Next Build on master (#237)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc