DEV Community

Discussion on: Why is artificial intelligence driven by Python and not C++?

Collapse
 
atldev profile image
Chris

I don't argue with your point that Python has less pitfalls and is more productive for higher level programming, and that C++ is more performant, but it is erroneous to imply there is any "garbage" memory to be collected in C++; there is no Garbage Collector. This provides the precise control over memory usage (and performance) that make C++ the systems language of choice, despite it's complexity. I am interested in Rust though. Rust provides compiled performance with automatic but synchronous memory deallocation for more deterministic performance characteristics and memory profiles when compared to asynchronous GC approaches like those applied in Java, .Net, and GoLang.

Collapse
 
evilprince2009 profile image
Ibne Nahian • Edited

Im not criticising C++. Its one of the best programming languages ever made. But Im not talking about system programming or OS, Kernel stuff. System programming is something that requires more efficiency rather than productivity. AI, ML, DS things are completely different. If you deal AI, ML things with a VM language like Python or JS , thats fine. But when it comes to system programming , VM languages are horrible choice. Despite of all complexities , drawbacks C/C++ are by far the best choice for system programming.

Collapse
 
neokeats profile image
neokeats

« synchronous memory deallocation for more deterministic performance characteristics and memory profiles when compared to asynchronous GC approaches like those applied in Java, .Net, and GoLang. »

It’s not that obvious.
GC can be more performant because it’s not up to the dev to decide when the desallocation should happen.
It’s the role of the GC to decide if the system don’t have better tasks to do and deallocate memory at the right time by doing it for all unreferenced data in one go.
Of course in theory you can be as efficient about as a program but in the context of others program run at the time as yours, it’s less than obvious. You’ll most likely slow the machine by running memory desallocation while there is largely enough memory left etc...

Collapse
 
misterscott profile image
MisterScott

Just mentioning that there are GC libraries available for C/C++. You are not forced to use them.