Sha256: 6fe06dd7617844e0a447aaede6e8248b6ec036e546011549fea44c110109063f

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

## [![Build Status](https://travis-ci.org/pavlik4k/pluck_json.svg?branch=master)](https://travis-ci.org/pavlik4k/pluck_json)


## Benchmark

```ruby
require 'benchmark/ips'

Benchmark.ips do |x|
  LIMIT = 20000
  columns = %i(id)
  x.report('as_json') { Incident.limit(LIMIT).select(*columns).as_json }
  x.report('pluck_json') { Incident.limit(LIMIT).pluck_json(*columns) }
  x.compare!
end

Calculating -------------------------------------
             as_json     1.000  i/100ms
          pluck_json     1.000  i/100ms
-------------------------------------------------
             as_json      0.585  (± 0.0%) i/s -      4.000  in   6.876732s
          pluck_json     16.215  (±12.3%) i/s -     80.000

Comparison:
          pluck_json:       16.2 i/s
             as_json:        0.6 i/s - 27.72x slower



Benchmark.ips do |x|
  LIMIT = 20000
  columns = %i(id category_id user_id)
  x.report('as_json') { Incident.limit(LIMIT).select(*columns).as_json }
  x.report('pluck_json') { Incident.limit(LIMIT).pluck_json(*columns) }
  x.compare!
end

Calculating -------------------------------------
             as_json     1.000  i/100ms
          pluck_json     1.000  i/100ms
-------------------------------------------------
             as_json      0.550  (± 0.0%) i/s -      3.000  in   5.463522s
          pluck_json     10.586  (± 9.4%) i/s -     53.000

Comparison:
          pluck_json:       10.6 i/s
             as_json:        0.5 i/s - 19.25x slower
```


## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/pavlik4k/pluck_json. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.


## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pluck_json-0.1.1 README.md
pluck_json-0.1.0 README.md