My son and I got a chance to sit down, and he could introduce me properly to AI via Claude. I was impressed. We wrote a simple command-line version of solitaire (actually, we convinced Claude to do this), and Claude generated it in seconds. Wait. How about a windows GUI form? Done. OK, my son typed in, give me a list of 25 desireable upgrades we could perform on this code, and it gave them, which included a top scores list, retract a move or seven, replay those moves, even play music in the background while you play the game. He said, go ahead and implement them. It did, in a few seconds. On my laptop, I played the game. The improvements worked. I was impressed some more. Then it hit me. He seemed to be on a plan that had plenty of tokens. I suggested we do something more challenging⦠convert Asterisk from C to Rust.
So he commanded it. It complained that Asterisk had 1.6 million lines of code. It was a huge project. Was he serious? Of course he was serious, and he commanded, āProceedā. It broke up the task into smaller pieces, and it did it. Took some minutes. It self-verified the new code worked, and wrote some of its own tests. Ryan (my son) commanded it to find all the tests. It came up with a thousand tests. He had it ensure that all those tests passed. And to correct the code or the test so it would work. That took a few hours. Then there were the CVEās active against Asterisk. It displayed a table of all the CVEās filed, and solved, and half of them were not possible in Rust. Then he had it do a performance comparison between the C and Rust versions. In the SIP processing, it declared with a table, that Rust was 2x to 5x faster than C. It gave a long list of reasons for the performance increase. After thinking about the scope of the project, and the fact that the PJproject code would have to heavily involved in the process, I asked what it had done to the pjproject code. It said, basically, that it had re-written it and didnāt really need the pjproject code. Of course, Asterisk was probably not using a fairly substantial part of pjproject⦠so, why not just fill in the functions yourself? Well, my son then got going, and had it fully generate a pjproject Rust equivalent, a snap-in replacement for pjproject, with the full API presented, which it did, fairly quickly. Then he had it pull in all the regression tests, and guarantee that every test passed. This took a while longer. A few times, getting late into the evenings, he ran out of tokens, but they renewed the next morning, so we/he kept going. It skipped some channels, some apps, etc. but it gives a fair view of Asterisk in Rust.
Uploaded to Github: GitHub - ryanmurf/asterisk-rs: Asterisk PBX rewritten in Rust ā 2-5x faster, memory-safe Ā· GitHub
Now, I wonāt even begin to discuss the far-reaching ramifications of what we did. I donāt know how many man-months of coding, debug, and testing were performed in about maybe 3 days by Claude at our request, but my estimate is like at least 2-6 months of by-hand crafting, and my Rust capabilities are very near nil. As far as I can tell, there are possible legal, financial, moral and ethical issues represented here, also economic, social, political, and maybe even religious issues. But also, AI, in my opinion is a tool for the average coder to improve his productivity by who-knows-how-many-hundreds of percent over what he can do without. Especially if you end up trying to maintain old code. I later did an experiment where I converted fail2ban from Python into C and Rust with Gemini, and got it to run 170x faster than the python it is currently available in, with the final numbers like 300,000+ lines of log file sifted for multiple patterns per SECOND, and that again, by the Rust version, fully feature compatible with the current version, reading the same config files, banning and lifting bans as requested, and passing all the regression tests. Sometimes, we need to do experiments, and see what might help our organizations to shave off some CPU cycles from processes running on heavily loaded systems. Sometimes, our packages are written in the wrong language for an operating environment. And, as far as I can tell, Claude and Gemini can handle languages like C, Python, PHP, Rust, Julia, autoconf ansible, and even Wolfram. Iāll wager C++, perl, Ruby, Java, SNOBOL, make, cmake, autoconf, and hundreds of others. Ooooops! I expounded enough.
Enjoy.