5 ms·
Exactly the kind of code I make. I use C for performance.... as an extension for python that have a GC and a GIL. But more than never, I first use numpy (fortr
by SFjulie1 11y ago
Exactly the kind of code I make.
I use C for performance.... as an extension for python that have a GC and a GIL.
But more than never, I first use numpy (fortran) because it is dazzling fast and has specialized tricks of digital signal processing availables (ifft).
And I do C after the profiler says to do so. When needed. If needed.
Most of the dynamic data structure (message sent with zmq) the config, the parsing are better handled in python.
And since I do as much sloc / day in C and python ...
(1 python loc = 6 C loc)
I code 6 times faster.
And I don't have the headeaches of the dependency management
I am totally okay with C, but when doing distributed system more often than never you also multi-threading. And C is not builtin for thread safety, it is harder.
So I C some masochisms at work here.
And I am pretty sure I am not the only coder thinking this book is full of pedantism and of advices not to be followed and it is empty.
How did such a poor news made it to the top?
- vidarh 11y ago> more often than never you also multi-threading This is a Windows-ism that's crept into Unix-likes over the years, and it's not a good trend. Just don't do it. Especially since sharing direct access to state makes it harder to decouple components to scale them further. This book specifically argues to pass state via IPC for a reason. > And I am pretty sure I am not the only coder thinking this book is full of pedantism and of advices not to be followed and it is empty. Maybe, but iMatix has been a successful company for more than two decades, and delivered impressive open source applications (e.g. Xitami web server) and code-generation tools (Libero ec.) as well as cross-plaform utility libraries for C (SFL etc.) already two decades ago, and have gone on to develop large-scale C-based distribued systems and in the process developed things like AMQ and 0MQ that's been incredibly successful, so I for one tend to at least pay careful attention as they actually do have a track record.
- SFjulie1 11y agoI know a lot of successful companies with products that are notoriously poorly coded : - "security software"; - "game industry"; - "car industry"; And if you read correctly I think the biggest issue is TIME is MONEY. What are the advantages of using techniques that: - are expensive (productivity is constant in sloc whatever the language); - are notoriously a systemic risks given their domain of work and is hard to audit; - that can be smoothly achieved by upgrading a faster to build architecture in a scripting language ; They may have bigger balls of steels than me doing it in C and be the best programmers in the world. My question is business oriented: what is the economic rationale of a full C solution from start?
- ArkyBeagle 11y agoBeats me. I know that if I had a large enough project and had to add people, I have a dozen people in my Rolodex who speak 'C' at the expert level and that they will perform. But depending on the problem domain, that might mean C++ or it might mean Python or something else. But given the level of hostility the language inspires, I have to wonder. To wit "bigger balls of steel" and "best programmers in the world." Both sentiments are quite foreign to the sorts of environments I've worked in, I assure you.
- SFjulie1 11y agoSorry for you then. Living in such a boring world, and what a disdain-full answer that makes my point. I have add my share of conferences technical or about FOSS. And I met peoples with a lot of passion ... and code delivered. You probably use their software daily. I have been using more than 13 langages ranking from C to forth, matlab, vhdl, spice, python, perl and php. There are definitively cultures associated with languages and beliefs. Perl community is thinking coding is like speaking/writing a foreign language; Ruby about you IQ and technical skills are totally correlated with how nice your apple laptop looks like and how expensive it is. They are our hipsters (troll); Python secretly hides a sect hating braces and everything that looks like C and believe C coder can't make safe thread code, malloc, correct string handling. And they hate braces. for c++ coder referring to linus torvalds rant would be the spirit. Java coder believe in the utltimate safe portable VM and the power of GoF. And think people look the wrong way; Haskell thinks of themselves as alchemists loving to use obscure terms coined by an hallucinated metaphyscian priest that said ET must exists and that no one will notice. They still laugh of their ultimate joke; And C coders think that only them are the pure programmer, the only one that can see the matrix between the purity of abstraction and the undetermination of hardware/norms due to the imperfection of the humans. But, with their discipline that is above the norm (no noob accepted) they can fight the God of Entropy FORTRAN coder think that computers are a pain and would just like to have exact figures much more than nice looking interface and wonder when a correct intuitive language will appear (<--- My sect) They appear maybe because for each language comes a practical field of use and that one computer language cannot fill all the needs. The need for correction and exactitude in science conflicts with the "ease of use" of numbers. The need for having cheap workforce conflicts with efficient cheap to maintain code; The need for preventing embezzlement (origin of SQL) conflicts with creative accountability; At one moment, at my opinion C is like a middle age corporation. Trying to promote a one best way of CS that always boil down to C. C community maybe "professional" as opposed to "enthusiasts". But I think it does not always serve them. And I do not think that recognizing Computer Science is a peaceful uniform land, but an arena full of organic entities in conflicts with logical distinct rationalities for the same resources. In short, I have the write to mock other cultures.
- fizixer 11y agoI'm in the exact same camp. I call it "two-language programming". Python+C beats the heck out of any single systems language, especially C++. And thanks to the amazing bloated complexity of the C++ language, the cognitive overhead of Python and C combined is way less than C++ (unless you stick to a tiny subset of C++ in which case you're just doing C-only, with slightly cleaner syntax). I'm still deciding on the best approach for the interface between Python and C. I don't like ctypes/cython etc because they require you to modify python code. I'd much rather create CPython extension but there is too much boilerplate. I'm looking into swig.
- SFjulie1 11y agoYou can also #include "python.h" in C and use cpython to handle from C dynamic data structures and manually do the incref, decref. If you are totally crazy you can also manipulate the frame to bring exception with stack trace in C... I don't do black magic. :) Very wrongly vulgarized you can integrate python as a runtime for your C code.
- eliben 11y agoIIRC with Numpy you get CBLAS by default, so not Fortran. But I don't believe there's a noticeable speed difference between them