I was chatting with a friend and joked "curl is such a Swiss army knife, it makes the Swiss blush". That made me wonder if it could do actual compute...
A few prompts to Claude Opus 5.5 later it had a possible way forward, using the file:// protocol and the expand-variables feature from curl to have it read files from disk that then tell it what to fetch next. Repeat this a few million times and you have a working CPU.
Claude wrote a working demo of a RISC-V CPU using curl in a few hours, but the frames came in at 1 frame per 8.3 hours. Most of it was spent loading curl itself and almost half the instructions were software multiply/divide. It suggested it could cut it down if it could just statically compile curl to just support the file:// protocol, as curl loads 33 libraries and sets up OpenSSL before reading a single byte. Along with that it suggested to use the M extension to do multiplication / division look-ups. That saves most of the rest of the time.
Vashiru•11m ago
A few prompts to Claude Opus 5.5 later it had a possible way forward, using the file:// protocol and the expand-variables feature from curl to have it read files from disk that then tell it what to fetch next. Repeat this a few million times and you have a working CPU.
Claude wrote a working demo of a RISC-V CPU using curl in a few hours, but the frames came in at 1 frame per 8.3 hours. Most of it was spent loading curl itself and almost half the instructions were software multiply/divide. It suggested it could cut it down if it could just statically compile curl to just support the file:// protocol, as curl loads 33 libraries and sets up OpenSSL before reading a single byte. Along with that it suggested to use the M extension to do multiplication / division look-ups. That saves most of the rest of the time.
The end result is 1 frame per +- 40 minutes.
Live page: https://doom.vashiru.tech Source code: https://github.com/Vashiru/curl-doom (RISC-V (RV32IM) computer whose CPU is curl, that just happens to run DOOM).