Author Topic: Python vs C in the age of AI  (Read 1581 times)

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9648
    • View Profile
Python vs C in the age of AI
« on: July 29, 2024, 07:49:52 PM »
This is interesting....

Quote
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/1817720357647761622

There 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.pdf

So 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.

rcjordan

  • I'm consulting the authorities on the subject
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 16867
  • Debbie says...
    • View Profile
Re: Python vs C in the age of AI
« Reply #1 on: July 30, 2024, 11:21:11 AM »
<Debbie added a reality check with strike-throughs>

There's No Future for Slow-Moving Code Monkeys and They Know It - Business Insider

https://www.businessinsider.com/with-ai-theres-no-future-for-slow-moving-code-monkeys-2024-7

    Artificial intelligence is now the top priority for major tech firms.
    Software engineers know they need to do more than just code to stay relevant in the AI era.
    But the way forward isn't to push back against AI — it's to embrace it, they tell BI.

Software engineers know that the days of simply being able to code are behind them.

After all, artificial intelligence taking over jobs is not new — numerous tech giants over the past two years announced that they were axing jobs to focus more on artificial intelligence development.

Last year, Google slashed 12,000 jobs — 6% of its then workforce — as the company began shifting its priorities toward AI.

In May 2023, IBM announced that it would pause hiring for roles that could be replaced by AI. The affected roles, which amounted to 26,000 jobs, included those in human resources and other non-consumer-facing departments.

But AI has had a direct impact on software engineers, too.

Although AI has helped to increase their productivity by helping to debug and generate code, software engineers that Business Insider spoke to said that they expect the industry to shrink simply because it doesn't need as many workers as they do today.

ergophobe

  • Inner Core
  • Hero Member
  • *
  • Posts: 9648
    • View Profile
Re: Python vs C in the age of AI
« Reply #2 on: July 31, 2024, 03:56:00 PM »
>> doesn't need as many workers

I keep coming back to Seth Godin's comment from right after ChatGPT started making headlines: AI is the death of mediocrity.

The internet boom allowed a lot of mediocre writers to make a living as writers. The tech boom in general has allowed a lot of mediocre software developers to make a living developing software. But when machines can do the production work, there are no jobs for mediocre workers.

Of course, at a certain point, there is no work for even the best of the best, but I would bet there is at least one person still making a living as a wheelwright repairing wagon wheels. Lots of people still make a living as blacksmiths and custom furniture makers. Automation just keeps raising the bar on how good you have to be to keep making a living in those professions.