andrewthauer / asdf-alias

Version aliases for asdf-vm
MIT License
26 stars 7 forks source link

removing and setting up aliases is extremely slow #11

Open mjobin-mdsol opened 3 weeks ago

mjobin-mdsol commented 3 weeks ago

Describe the bug

Setting up aliases with asdf is a feature I missed from the time I was using rvm luckily I found your plugin and it seemed to do everything I wanted

Except that it so slow to create and remove aliases, while it should be quasi instant, at least it was with rvm why is it taking so long?

C02C931KLVDL:lyceum majobin$ time asdf alias ruby 3.1.5 --remove

real    1m52.208s
user    0m15.588s
sys 0m50.871s
C02C931KLVDL:lyceum majobin$ time asdf alias ruby 3.1.5 3.1.6
3.1.5 => 3.1.6

real    1m55.978s
user    0m15.844s
sys 0m52.389s
C02C931KLVDL:lyceum majobin$

Steps to reproduce

create or remove an alias

Expected behavior

it should be fast, nearly instant.

Screenshots

image

Additional context

mjobin-mdsol commented 3 weeks ago

I wrote this script to reset my ruby aliases automatically. And unfortunately, it's taking too much time to run

#!/bin/bash
# https://github.com/andrewthauer/asdf-alias
# asdf plugin add asdf-alias
# or
asdf plugin add alias https://github.com/andrewthauer/asdf-alias.git

asdf_redo_alias() {
  plugin=$1
  latest_rev=$2
  old_revisions=$3

  for cur_revision in $old_revisions
  do
    echo "removing $plugin $cur_revision and aliasing to $latest_rev"
    asdf alias $plugin $cur_revision --remove
    asdf uninstall $plugin $cur_revision
    asdf alias $plugin $cur_revision $latest_rev
  done
}

asdf_redo_alias ruby "3.2.5" "3.2.0 3.2.1 3.2.2 3.2.3 3.2.4"
asdf_redo_alias ruby 3.3.4 "3.3.0 3.3.1 3.3.2 3.3.3"
asdf_redo_alias ruby 3.1.6 "3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5"