Electroman
Well-Known Member
Agreed. For someone who has worked on C compilers, I don't see the allure of C++I would never choose c++ over c
You can install our site as a web app on your iOS device by utilizing the Add to Home Screen feature in Safari. Please see this thread for more details on this.
Note: This feature may not be available in some browsers.
Agreed. For someone who has worked on C compilers, I don't see the allure of C++I would never choose c++ over c
You might want to check out Swift at some point. It’s pretty mature now.
In my more recent life developing and publishing iOS apps including a couple of full featured and highly rated ones, I can attest that Swift is far superior to Objective-C. You can be vastly more productive in Swift and the resulting code, even without tests or using Apple’s analysis tools (i.e. Instruments), is much more robust.
Except for one thing, I would use Swift for everything (that one thing isn’t scripting, Swift allows that). If I were to ever return to a former life writing code simulating neural models or, really, any code that implemented some hard core, secret sauce type dense computational code, I might still use C or a derivative thereof. Granted that is a big exception and the one that likely would matter to you, but that exception won’t last much longer.
One stated goal of the current Swift team is to “kill off” C++ at Apple. This was in one of the recorded WWDC Swift language session videos this year or last (don’t recall which session).
I suspect that Chris Lattner only lasted six months at Tesla because he probably wanted to move Tesla to Swift and there was resistance at Tesla. Lattner was the main person behind the creation of Swift at Apple.
I can understand why Tesla might prefer not to have Swift for their Software 2.0 neural network code and use C/C++ for the time being. However, that likely leaves a lot of code that might be more productively written in Swift.
As an aside, Apple has also made considerable progress on concurrency for practical use.
Sorry for general signal processing and data science problems you start in a high level language to explore and determine what methods are going to work best for the data you have.
Have to load varied forms of data? Massive pain in C, easy with accessible Python libraries.
Want to interact and plot data in C++? LOL what a pain.
Want to quickly test out different filtering techniques or other DSP stuff to see what works best with your data? Easy in Python and open source packages. Wayy slower in C.
Yes if you know what model architecture you are going to use, just code it in C++.
But most data driven algorithm problems in data science require so much data cleaning, partitioning, and analysis, and these are way faster in Python. This is a key point. The running of final algorithm chosen is a small piece of the puzzle.
The proper analogy is you are going to have to construct a building 10 times, but it's 10 times faster in Python. So you build it 9 times in Python, then once in C, and end up ahead.
That's why Python is do popular, and growing in the data science community.
I would never choose c++ over c
You're describing utilities. There are also command-line plotting and data-analysis tools, but I'm not going to call that programming, either.
There's plenty of nice Python libraries. but Python fundamentally compromises your ability to do fast, memory-efficient programming - e.g. developing new things that don't already exist. Its loose typing (and general lack of compiletime error-detection) and lack of extensibility to its slow, memory-hungry internal types and data structures makes it a bad choice for large, complex, performance-critical tasks.
But if you just want to plot out some graphs from a small CSV file, go knock yourself out. Just don't spend time writing a million lines of actual code that you're going to have to rewrite.
SNAconnection conn = new SNAconnection("Mainframe");
(so you didn't have to create your own libraries and research from scratch), then sure - you could skip development in one and redevelopment for performance optimization.
Cython is another hybrid approach, generating and compiling C code on the fly from a dialect of Python.
However, because Python is dynamically typed, it's not generally practical to completely precompile all possible code paths, and it won't ever be as fast as mainstream statically typed languages, even if JIT-compiled.”
UC Berkeley uses Python in CS 61A, Java in 61B, and C in 61C. They are their CS major intro, data structures, and machine-level 13-week semester courses. Cal used to use Scheme, a Lisp derivative for 61A! (+ 40 2) evaluates to 42 isn’t that fun!?
UCLA on the other hand uses C++, C++, C for their equivalent 3 first CS major 10-week quarter courses.
I haven’t checked Stanford and USC.
I mention this only because Tesla probably has many Cal EECS geeks on their FSD team using their first love, Python. Cal is still ranked #1 in CS I believe, although overall UCLA is now ranked as #1 public university in USA.
Personally I had great success once rewriting vendor libraries, with our own code, a 10x improvement in speed and quality..... it is memorable as my decision was partially driven by desperation .....
I'm sure if something like that would help, Tesla and Elon are already on to it.
Way to early for that. Maybe one day, but not yet. Maybe by that time most code will be written by LLMs anyway...Could Tesla switch to Mojo?
Chris Lattner discusses Mojo here - suggests it has the benefits of Python with the speed of C++.