[x] cache color schemes (The color preview requires not only the list of color schemes, but the actual color scheme files. It's slow to fetch all color schemes every time the command runs.)
Caching
I tried git for caching at first, but the iTerm2 color schemes repo has many different things and weighs more than 100MB including .git. 100MB is not acceptable for this tool.
Now color scheme files are downloaded with HTTP and saves as they are.
async/await
I introduced async/await for fun and learning. I parallelized two things:
reading files from file system: This didn't improved the performance much because it's capped by the file system IO
downloading color schemes via HTTP: Downloading ~200 files in parallel didn't work because of an error HTTP request error: ConnectFailed: failed to connect to the server. Batching with 10 requests worked and improved the performance. Manual batching wouldn't have been necessary if I could configure the HTTP client's max connection count, but surf doesn't expose the API.
11
Caching
I tried git for caching at first, but the iTerm2 color schemes repo has many different things and weighs more than 100MB including
.git
. 100MB is not acceptable for this tool.Now color scheme files are downloaded with HTTP and saves as they are.
async/await
I introduced
async/await
for fun and learning. I parallelized two things:surf
doesn't expose the API.