Russell Sim's Blog

ASDF-VM  Updated:

Keywords: #shell

I have been using chruby for about 2 years. But when I started in the team I choose chruby because people on my team were using it. I did consider changing every time I hit a rough edge like Emacs integration, or some other thing. The other viable option seemed to be rbenv, which was widely used but I had only ever seen it installed on systems. I did always think that it's model of using shims was a bit better than chruby that updates the PATH. Mostly because the shim model provides better integration with any program that generates sub-processes, this because the complexity of managing the interpreters is done with these wrapper shims instead of burdening the program with being aware beyond just adding it to your path, you just need to execute from within the context of the project.

Gradually though, as I started contributing ettings updateto more projects, and needed more interpreters, it seemed like the list kept growing. I used pyenv for python in a previous job, and then when working in TypeScript, I used nvm. It's amazing how each language seemed to be solving the same problems over and over.

I do think it's a bad sign when there is so much duplication of effort configuring all the alternative implementations, but they worked for the most part. The final straw was when I noticed my shell was taking an unreasonable time at start. Maybe 4 seconds to get to the prompt, long enough for me to even think it could be DNS.

So I decide to profile the evaluation of my zshrc. ZSH has a module that can help with profiling called zprof it can be used like this.

zmodload zsh/zprof
# ... the code you want to profile

It outputs a whole lot of timing information, and bam. NVM, there it was, it was most of my startup time. There was an outstanding bug1 it had already been open a few months, and i wasn't the only person looking for alternatives.

I can't remember how I came across ASDF-VM2, it was probably on a news site. But it's a real game changer in terms of both being a universal interface and using the shim model for mapping different interpreter versions.