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

DavyJonesLocker / client_side_validations / 542 / 10
100%
main: 100%

Build:
Build:
LAST BUILD BRANCH: releases/23.1.0
DEFAULT BRANCH: main
Ran 18 Dec 2016 01:10PM UTC
Files 29
Run time 1s
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

18 Dec 2016 12:59PM UTC coverage: 99.496% (-0.001%) from 99.497%
2.3.3, gemfiles/rails_4.0.gemfile

push

travis-ci

tagliala
Improve build_validation_options method

Use `<<` instead of string interpolation

```ruby
require 'benchmark/ips'

def interpolation(options)
  name = 'name'
  name = "#{name}#{options[:multiple] ? '[]' : nil}"
end

def push(options)
  name = 'name'
  name << '[]' if options[:multiple]
end

Benchmark.ips do |x|
  x.report('interpolation (true)')  { interpolation(multiple: true) }
  x.report('interpolation (false)')  { interpolation(multiple: false) }
  x.report('push (true)') { push(multiple: true) }
  x.report('push (false)') { push(multiple: false) }
  x.compare!
end
```

Result:

```
$ ruby bench.rb 
Warming up --------------------------------------
interpolation (true)    85.563k i/100ms
interpolation (false)
                        79.544k i/100ms
         push (true)    96.962k i/100ms
        push (false)   108.172k i/100ms
Calculating -------------------------------------
interpolation (true)      1.231M (± 5.1%) i/s -      6.161M in   5.017881s
interpolation (false)
                          1.144M (± 5.0%) i/s -      5.727M in   5.018903s
         push (true)      1.402M (± 7.7%) i/s -      6.981M in   5.013148s
        push (false)      1.529M (±11.0%) i/s -      7.572M in   5.021825s

Comparison:
        push (false):  1528576.6 i/s
         push (true):  1402083.9 i/s - same-ish: difference falls within error
interpolation (true):  1230966.2 i/s - 1.24x  slower
interpolation (false):  1144093.1 i/s - 1.34x  slower
```

592 of 595 relevant lines covered (99.5%)

21.75 hits per line

Source Files on job 542.10 (2.3.3, gemfiles/rails_4.0.gemfile)
  • Tree
  • List 0
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 542
  • Travis Job 542.10
  • c136a974 on github
  • Prev Job for 2.3.3, gemfiles/rails_4.0.gemfile on master (#539.10)
  • Next Job for 2.3.3, gemfiles/rails_4.0.gemfile on master (#543.10)
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