
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
NativeRuby is a standard library for Ruby implemented in Ruby, designed to take advantage of the YJIT compiler for improved performance. It provides optimized, native Ruby implementations of various core methods and iterators while maintaining the familiar Ruby API. π₯
The performance improvements provided by NativeRuby are primarily seen when YJIT is enabled. Without YJIT, you may not notice significant performance gains. For the best results, always use NativeRuby with YJIT enabled.
Add this line to your application's Gemfile:
gem 'native_ruby'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install native_ruby
To use NativeRuby in your project, you first need to require it:
require 'native_ruby'
Then, you can configure which optimized methods you want to use:
NativeRuby.config do |c|
# Load all immutable iterators
c.load_all_immutable_iterators!
# Load all mutable iterators
c.load_all_mutable_iterators!
# Load all optimized methods for a specific class
c.require_all_for_class!(Array)
# Load a specific method for a class
c.load(:class, { class: Array, method: :bsearch })
# Load a specific iterator (mutable or immutable)
c.load(:iterators, { class: Array, method: :each, mutable: false })
end
load_all_immutable_iterators!
: Loads all immutable iterator optimizations.load_all_mutable_iterators!
: Loads all mutable iterator optimizations.require_all_for_class!(klass)
: Loads all optimized methods for a given class.load(type, options)
: Loads a specific optimized method or iterator.
type: :class, class: ClassName, method: :method_name
type: :iterators, class: ClassName, method: :method_name, mutable: boolean
NativeRuby is specifically designed to work with YJIT (Yet Another Just-In-Time Compiler for Ruby). The performance improvements are primarily realized when YJIT is enabled.
To use NativeRuby with YJIT and see the performance benefits:
ruby --yjit your_script.rb
Without YJIT enabled, you may not see significant performance improvements. Always use NativeRuby with YJIT for optimal results.
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/sebyx07/native_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the NativeRuby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that native_ruby demonstrated a not healthy version release cadence and project activity because the last version was released 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socketβs AI scanner detected the supply chain attack and flagged the malware.
Security News
CISAβs 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.