
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
ruby_native_statistics
Advanced tools
This is a native extension to Ruby that adds native (Rust) statistical functions to the Array class. At present the following functions are provided:
Check the Github Actions build to see the currently supported versions of Ruby. This list will match whatever stable versions are specified at https://www.ruby-lang.org/en/downloads/.
It is generally more performant than calculating these values with pure Ruby. For a comparison, run the benchmarks with rake benchmark
.
Here's the data converted to a Markdown table:
Benchmark (Ruby 3.4.4) | Run 1 | Run 2 | Run 3 | Run 4 | Run 5 |
---|---|---|---|---|---|
bench_ruby_median | 0.000676 | 0.000611 | 0.000619 | 0.000620 | 0.000583 |
bench_native_median | 0.000179 | 0.000167 | 0.000127 | 0.000118 | 0.000188 |
bench_ruby_stdev | 0.000780 | 0.000767 | 0.000730 | 0.000718 | 0.000733 |
bench_native_stdev | 0.000046 | 0.000027 | 0.000034 | 0.000026 | 0.000043 |
bench_ruby_mean | 0.000261 | 0.000240 | 0.000242 | 0.000250 | 0.000241 |
bench_native_mean | 0.000033 | 0.000023 | 0.000022 | 0.000028 | 0.000022 |
If you found a bug or need a particular function, please let me know! I work on this gem in my spare time, mainly for learning purposes. Feel free to open a PR or a Github issue and I'll take a look as soon as possible.
require 'ruby_native_statistics'
r = [1,3,21,32,42]
# calculate sample standard deviation, you can also use "stdevs"
p r.stdev
# calculate population standard deviation
p r.stdevp
# calculate sample variance
p r.var
# calculate population variance
p r.varp
# calculate mean
p r.mean
# calculate median
p r.median
# calculate percentile
p r.percentile(0.3333)
If you are installing the source vesion of the Gem, be sure to have libclang, e.g. libclang-dev
, installed on your system.
Percentile uses the same rounding method as Excel, sometimes called R7.
FAQs
Unknown package
We found that ruby_native_statistics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.