Commit 97d5305
authored
perf: speed up self-update by calling /releases/latest api instead of /releases (#4619)
Using `ReleaseList` ends up calling
`https://api.github.com/repos/jdx/mise/releases` but it was only being
used to get the latest version.
Now `Update` is reused which has a `get_latest_release` that calls
`https://api.github.com/repos/jdx/mise/releases/latest`.
As reference this are the sizes of the responses of each of the
endpoints
- https://api.github.com/repos/jdx/mise/releases 2,4M
- https://api.github.com/repos/jdx/mise/releases/latest 77k
This are the results before and after in my case:
before:
```
➤ time mise self-update
Checking target-arch... mise-v2025.3.2-linux-x64.tar.gz
Checking current version... v2025.3.2
Checking latest released version... mise is already up to date
mise plugin:dotnet ✓ https://github.com/mise-plugins/mise-dotnet.git#162124c
________________________________________________________
Executed in 7.17 secs fish external
usr time 146.07 millis 0.65 millis 145.42 millis
sys time 82.81 millis 1.22 millis 81.58 millis
```
after:
```
➤ time mise self-update
Checking target-arch... mise-v2025.3.2-linux-x64.tar.gz
Checking current version... v2025.3.2
Checking latest released version... mise is already up to date
mise plugin:dotnet ✓ https://github.com/mise-plugins/mise-dotnet.git#162124c
________________________________________________________
Executed in 1.96 secs fish external
usr time 67.64 millis 891.00 micros 66.74 millis
sys time 52.84 millis 939.00 micros 51.90 millis
```
It still takes longer than what I would expect, considering the time
`mise upgrade` takes:
```
➤ mise ls --current
Tool Version Source Requested
bun 1.2.5 ~/.config/mise/config.toml latest
deno 2.2.3 ~/.config/mise/config.toml latest
node 22.14.0 ~/.config/mise/config.toml lts
usage 2.0.5 ~/.config/mise/config.toml latest
➤ rm -r ~/.cache/mise/
➤ time mise upgrade
mise All tools are up to date
________________________________________________________
Executed in 171.74 millis fish external
usr time 19.08 millis 0.00 micros 19.08 millis
sys time 17.74 millis 737.00 micros 17.00 millis
```1 parent 5a57032 commit 97d5305
1 file changed
+16
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
58 | | - | |
59 | | - | |
| 57 | + | |
| 58 | + | |
60 | 59 | | |
61 | | - | |
| 60 | + | |
62 | 61 | | |
63 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
75 | 72 | | |
76 | | - | |
77 | 73 | | |
78 | 74 | | |
79 | 75 | | |
80 | 76 | | |
81 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
82 | 81 | | |
83 | 82 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 83 | | |
89 | 84 | | |
90 | 85 | | |
91 | 86 | | |
92 | 87 | | |
93 | 88 | | |
94 | 89 | | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | 90 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 91 | | |
104 | 92 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | 93 | | |
109 | 94 | | |
110 | 95 | | |
| |||
0 commit comments