Socket
Book a DemoInstallSign in
Socket

super_mean

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

super_mean

0.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

SuperMean

Gem Version

Arithmetic mean from array written in C.

Installation

Add this line to your application's Gemfile:

gem 'super_mean'

And then execute:

$ bundle

Or install it yourself as:

$ gem install super_mean

Usage

This gem just adds #mean method for arrays.

[1, 2, 3].mean
# => 2.0

Benchmark

Conditions:

ary = (0..100_000_000).to_a

Benchmark.bmbm(7) do |x|
  x.report('Ruby') do
    ary.inject(&:+) / ary.size
  end

  x.report('C') do
    ary.mean
  end
end

Results:

Rehearsal ----------------------------------------------
Ruby         8.690000   0.070000   8.760000 (  9.720472)
C            0.480000   0.000000   0.480000 (  0.536145)
------------------------------------- total: 9.240000sec

                 user     system      total        real
Ruby         8.950000   0.240000   9.190000 ( 10.445315)
C            0.440000   0.000000   0.440000 (  0.460983)

Contributing

  • Fork it (https://github.com/droptheplot/super_mean/fork)
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 13 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.