Comments (4)
Can you try it with $RBENV_ROOT/versions/3.2.3/bin/ruby
? rbenv uses shell shims for invoking ruby or other related commands.
$ hyperfine "ruby -e 1"
Benchmark 1: ruby -e 1
Time (mean ± σ): 166.6 ms ± 143.7 ms [User: 37.1 ms, System: 20.4 ms]
Range (min … max): 113.8 ms … 575.1 ms 10 runs
$ hyperfine "~/.local/share/rbenv/versions/3.2.3/bin/ruby -e 1"
Benchmark 1: ~/.local/share/rbenv/versions/3.2.3/bin/ruby -e 1
Time (mean ± σ): 50.7 ms ± 38.0 ms [User: 26.6 ms, System: 13.2 ms]
Range (min … max): 39.6 ms … 187.9 ms 15 runs
from ruby-build.
Well. So it's shims... Just want Ruby to be a bit faster. I apologize for the anxiety. You can close the issue.
hyperfine '.rbenv/versions/3.2.4/bin/ruby -e 1'
Benchmark 1: .rbenv/versions/3.2.4/bin/ruby -e 1
Time (mean ± σ): 110.1 ms ± 2.8 ms [User: 84.5 ms, System: 25.1 ms]
Range (min … max): 107.3 ms … 118.5 ms 26 runs
hyperfine '/usr/bin/ruby -e 1'
Benchmark 1: /usr/bin/ruby -e 1
Time (mean ± σ): 106.7 ms ± 1.0 ms [User: 82.3 ms, System: 24.1 ms]
Range (min … max): 104.1 ms … 108.7 ms 27 runs
from ruby-build.
The slowness of rbenv as opposed to invoking a ruby
binary directly is known and documented (linked from the README): https://github.com/rbenv/rbenv/wiki/Comparison-of-version-managers
from ruby-build.
Just want Ruby to be a bit faster
100 ms for a process startup can indeed feel slow, but sometimes that can't be helped with the Ruby interpreter. Depending on your system resources, 50–100 ms might be a reasonable amount of startup time. On my machine, it's more like 30 ms.
If you want to further speed up Ruby, you can disable it loading Rubygems with --disable-gems
. Here it is on my Apple M1 machine:
$ hyperfine --warmup 5 '~/.rbenv/versions/3.2.2/bin/ruby --disable-gems -e 1'
Time (mean ± σ): 6.2 ms ± 0.4 ms [User: 3.6 ms, System: 2.1 ms]
Range (min … max): 5.8 ms … 7.6 ms 360 runs
Of course, a ruby interpreted started this way is less useful because it won't be able to load any gem dependenices.
from ruby-build.
Related Issues (20)
- Can we skip installing readline when Ruby version is greater than 3.3.0? HOT 3
- Giving multiple optflags raises unrecognized option error. HOT 3
- Cannot install Ruby versions 2.6 using asdf
- can't install 3.2.3 ruby version from rbenv
- ruby-build: definition not found: 3.3.0.rc1 HOT 3
- Wiki open to edits HOT 2
- Ruby 2.2.10 install fails due to OpenSSL issue HOT 3
- RUBY_BUILD_MIRROR_URL ignored HOT 7
- Can't upgrade above 20211019 via brew on macos HOT 3
- 3.3.1 fails to build YJIT with Homebrew LLVM 18 HOT 7
- install command prompts in non-interactive shell HOT 1
- Failure to detect bz2 HOT 6
- RUBY_BUILD_ROOT docs misleading
- Build failure of Ruby 3.3.1 and 3.3.2 on systems without [email protected] HOT 3
- CONFIGURE_OPTS='--disable-install-doc' is passed to the openssl build which fails HOT 1
- trying to install ruby 2.7.0 HOT 1
- Enable YJIT Seems to not support arm64 HOT 1
- Issues with installing ruby 3.3.4 on mac HOT 5
- [Feature Request] Enable SOCKS support by default HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruby-build.