This is interesting....
So, I coded a class in Python to do a heavy processing of a large text corpus. I made sure it works as expected. Then I asked Claude to rewrite my class in C (the language I don't know) and explain how to run it. Result: Python processing time: 63 minutes. C processing time: 2.3 minutes. This is the future for production cost savings.
https://x.com/burkov/status/1817720357647761622There is some research to suggest that things are often even worse (see Table 4 on p. 16 of this):
https://haslab.github.io/SAFER/scp21.pdfSo as programmers, we know that we can get things written many many times faster in Python, PHP, Scheme, etc than in a low-level language like C. The traditional solution has been
1. write something quickly
2. refactor the PHP (in my case) based on benchmarking code to find bottlenecks (I once found that 90% of script execution was getting image sizes to inject into the HTML).
3. throw computing power at it
4. if you need to scale, you can refactor things into C libraries that you can call from PHP. I will say that I personally never had such success that I needed to do this, but obviously when you're serving up millions of high-compute requests per day, you need to do something along these lines.
But as AI becomes proficient at refactoring in low-level languages, it becomes like a super compiler where you can imagine it being language agnostic. So then the process becomes:
- Ask AI to generate code in a language that you read and understand well.
- Ask it to include unit testing for everything (this has long been a standard in Drupal - no code change can be accepted without accompanying unit tests)
- Ask it to include integration testing
- Ask it to refactor the code into the more efficient languages and benchmark them against each other
- Ask it to run all tests to verify the refactoring has not introduces errors
- Deploy
This would require huge compute power and a lot of energy during development, would in the early years result in some catastrophic code failures (so it would need to be in fault-tolerant situations like shit posting on The Core rather than running nuclear power plants or automatic pilots), but could eventually result in massive savings in wasted computer power caused by running things in PHP or Python.
For a site that serves up <100,000 Wordpress pageviews per day, you would never pay back the effort, and that is probably most sites in the world. So maybe all of the above is BS... just thinking out loud about the possiblities.