improve load times w/ fixed gemset iteration#87
Conversation
New version adds ~15ms to `ruby -e 'puts "yo"' time :)
Quite possibly broken for more complex cases, but it's a start.
Also, I renamed the hooks to have their event name ('which', 'exec',
'rehash') in their filename so they're easier to pick out in
`RBENV_DEBUG=1` output.
Where we're at:
$ time ruby -e 'puts "yo"'
yo
real 0m0.173s
user 0m0.097s
sys 0m0.034s
Versus with all rbenv-gemset hooks removed:
$ time ruby -e 'puts "yo"'
yo
real 0m0.135s
user 0m0.078s
sys 0m0.025s
So added ~40ms with the hooks (rehash isn't used in that run). Not bad.
While I'm sure it was there for a reason - I recall there being weird and troublesome double executions going on when I dug into the rbenv-gemset stuff - it messes up subprocesses that run one lock exe invoked from inside another.
|
@AprilArcus @nrser can we leave out 5a1b480 ? Leave the versioning / scheme to me. I'll bump the version when this is done (and I think 3 numbers is enough already). |
|
re 5a382ef:
sorry, "adds"? Thanks for adding stuff like re the use of |
Yeah for sure, I just did that so I had a different version number for my fork and could tell the difference from a quick The commits you're looking at are the ones I made as I was writing it. I thought I would come back and rebase it up nice afterwards, but once I realized I wasn't going to have time for that any time soon I just shared my branch, figuring that given the magnitude of performance pain & gain people might want to use it regardless of the mess and lack of test. |
Oh, that meant that after the changes using Ruby through rbenv/gemsets only added an extra ~15ms spin-up time (compared to just running the system Ruby without rbenv). Before the changes, the rbenv/gemsets combo was adding around ~700ms over the system installation (testing with simple Eventually I think I ended up spending around 40ms for spin-up, having addressed more of the paths and features than I had at the point of 5a382ef |
Like I said previously, I was just committing as I was working along, thinking it would get rebased for publication. That stuff is just notes to self regarding what was broken on my machine. The "locks" are this: https://github.com/nrser/rbenv-lock lil' rbenv plugin I wrote to "lock" certain Gem executables to specific versions of Ruby. Like, if you use I use Ruby for a lot of personal tools and use a few tools distributed through gems and this annoyed the shit out of me, so I wrote a little plugin to try to fix it. What the comment's talking about is that QB - a tool I wrote to run Ansible roles against localhost from the CLI - is written in Ruby, and uses The tricky part is that QB may run tasks that invoke executables that are also written in Ruby, and may even use So exporting |
I don't really do much Bash (and I'm sure it shows), so I'm not sure how projects usually handle logging... but I know at least some tools have CLI options or ENV vars you can use to turn on debug logging in production releases, and I've had it be useful more than once when diagnosing issues. I see that |
|
any chance of merging this this year? |
|
Thanks for following up, @AprilArcus . This year? I should think so. I need to find time to review this again. I thought I stated somewhere the version bump implementation should be up to me... but I don't see it here. If I approve this, I will want to do it without the forced version bump. |
|
hi everybody, my sincere, sincere apologies for the long time that this has taken. Ideally, I should NOT have taken this long to get back to you, and for that I am deeply, deeply sorry. I have no excuse. Life hasn't been great for me; but I could have worked on this despite all of it. Some specific notes:
|
|
FYI I just finished dealing with an issue in my local setup (I've been bitten by a issue with bash that turned out to be caused by MacPorts that I've been puzzling over for a while) to get Just 2 points for now: ONE, for the record, there can be quite the bit of history behind some of the lines in the scripts, and I need to dig back into the archives to try to recall why something is a certain way. An example would be the call to TWO, at this point in time, I think what is likely to happen with this PR is that I will cherry-pick certain things to put into the master branch... instead of trying to clean up and fix whatever's here (as an example, the shebangs introduced from AprilArcus@1835c77 are actually unnecessary and dont even have any effect). So for now, I will leave this PR open until I've incorporated everything that I need. There will definitely be attribution though, in case anybody's wondering; not going to make this improvement without giving you guys the credit! Thank you for the patience. |
This PR merges @nrser's work to improve load times, as discussed at #84 (comment), with some trivial fixes to an iteration error from my own fork.