News for hackers. Stuff that matters.
Re:The Time Needed to Write “Effective Modern C++” by angersock on Thursday April 23, 2015 @02:15AM (#9425220)
Everything else isn't too slow, though, especially if you hit any meaningful IO.
Re:The Time Needed to Write “Effective Modern C++” by MrScruff on Thursday April 23, 2015 @06:21AM (#9425759)
There are many applications that either aren't typically IO bound, or where the IO (eg. gpu<->memory) is fast enough that you'll likely need C++ to maximise performance.

Writing software that pushes bleeding edge hardware is fun, which is why many people still want to learn C++.

Re:The Time Needed to Write “Effective Modern C++” by angersock on Thursday April 23, 2015 @12:39PM (#9427948)
Oh, sure, but the vast vast vast majority of applications--especially that people are hiring for--aren't what you're referring to.
Re:The Time Needed to Write “Effective Modern C++” by MrScruff on Thursday April 23, 2015 @03:59PM (#9429427)
Statistically I've no doubt you're right. However there are still a bunch of jobs where performance matters. If I left my job and industry, I'm fairly certain I could find another employer that found value in having a specific piece of code run as fast as possible.
Re:The Time Needed to Write “Effective Modern C++” by kbart on Thursday April 23, 2015 @04:15AM (#9425470)
Yeah, tell that to embedders and kernel/driver programmers.
Re:The Time Needed to Write “Effective Modern C++” by AlexandrB on Thursday April 23, 2015 @08:42AM (#9426265)
The irony is that at least one class of kernel developers (Linux) refuse to touch C++.
Re:The Time Needed to Write “Effective Modern C++” by GFK_of_xmaspast on Thursday April 23, 2015 @09:48AM (#9426608)
Yeah, but how much of that is because Torvalds has opinions and how much of it is actual fact and preference.
Re:The Time Needed to Write “Effective Modern C++” by CHY872 on Thursday April 23, 2015 @04:38AM (#9425508)
and there the additional complexity of C++ is a barrier to entry but no more, so no biggie in this context.
Re:The Time Needed to Write “Effective Modern C++” by blt on Thursday April 23, 2015 @09:52AM (#9426628)
I work on programs that are CPU and memory access bound.
Re:The Time Needed to Write “Effective Modern C++” by unstabilo on Thursday April 23, 2015 @03:03AM (#9425322)
Or if you use clever algorithms. I don't have benchmarks at hand, but I suspect that an FFT in Python is faster than a naive Fourier transform in C.
Re:The Time Needed to Write “Effective Modern C++” by stinos on Thursday April 23, 2015 @03:41AM (#9425392)
Not sure if this way of comparing programming languages (i.e. do A in language X and do B in language Y => Y is not slower than X) makes enough sense to draw conclusions. If you can use clever algorithms, in the majority of cases you'd do so in any language and in the majority of cases C would lead to more performant code than Python. Then again, wheteher this matters in the scope of the actual application is something else.
Re:The Time Needed to Write “Effective Modern C++” by verbin217 on Thursday April 23, 2015 @04:18AM (#9425473)
I suspect his comment meant to imply that a level of skill exists for which a programmer could build an FFT in python, a plain DFT in C, but not a proper FFT in C. That programmer would benefit from using python.
Re:The Time Needed to Write “Effective Modern C++” by nadam on Thursday April 23, 2015 @03:36AM (#9425384)
Theoretically this is true, but in practice, those who need to write very efficient code competitively, rarely use naive algorithms. (Pure C/C++ also isn't enough nowadays though, the processor isn't competitive with the GPU in a lot of algorithms, so CUDA/OpenCL needs to be also used in most cases.)
Re:The Time Needed to Write “Effective Modern C++” by GFK_of_xmaspast on Thursday April 23, 2015 @09:53AM (#9426637)
I think the replies to this post are getting confused between the FFT/DFT, which is O(n log n), and the "naive Fourier transform", O(n2).

My experience with numerics in regular python is that they're generally 50-500x slower than the equivalent in C/C++, this just pushes back the point at which the asymptotics take over.

Re:The Time Needed to Write “Effective Modern C++” by blt on Thursday April 23, 2015 @12:38PM (#9427939)
C has libraries too, you know :)
Re:The Time Needed to Write “Effective Modern C++” by easytiger on Thursday April 23, 2015 @03:44AM (#9425402)
Err, why?
Re:The Time Needed to Write “Effective Modern C++” by unstabilo on Thursday April 23, 2015 @07:18AM (#9425927)
My point is that a good algorithm, a good strategy can give you a several orders of magnitude speedup, more than the speed differences among languages. If a higher level language makes it easier and faster to develop good algorithms, then you should use that. After that, if you have time or really need it, you can re-implement it in hand-coded assembly, or even in hardware. But you generally don't have the time and don't really need it.
Re:The Time Needed to Write “Effective Modern C++” by chris_b on Thursday April 23, 2015 @03:53AM (#9425423)
Because the FFT in python is almost certainly implemented in C, and probably more cleverly done than a naive FFT that I/you/someone would whip up as part of a C program.
Re:The Time Needed to Write “Effective Modern C++” by easytiger on Thursday April 23, 2015 @04:34AM (#9425497)
Is this a joke? Something written with the same algorithm in c will be faster than python. Why not use someone elses non naive FFT impl in c then as well?
Re:The Time Needed to Write “Effective Modern C++” by rprospero on Thursday April 23, 2015 @08:25AM (#9426184)
I think the argument isn't that Python code out performs C code, it's that code written by mediocre Python programmers often outperforms code written by mediocre C programmers. C code is fast enough the mediocre programmers get used to letting the language bail them out. Python programmers know that their language is slow and that they have to work around it.

I've encountered this several times in my own career. A co-worker who writes in C will be implementing a process in parallel with my Python implementation. A week later, my O(N) Python code is outperforming my colleagues O(N^3) C code, since I chose a more complex algorithm which is trickier to get right. The C programmer then re-implements my method in C, which would completely trounce my own code, except I've spent that time leaning on BLAS and LAPACK, speeding up my operations again. The C programmer then starts using fast libraries instead of her own code, again beating my old source, only to find that I've now pushed a good chunk of the processing onto the GPU.

Eventually, I will run out of tricks. The final draft of the C code will trounce the final draft of my Python code. However, during most of the creation process, my Python usually out performs their C. Also, a truly talented C programmer would write my colleague's final draft as her first draft, negating every advantage that I had in the process. However, that's not a situation that I'm likely to run into, because places hiring truly talented programmers aren't likely to be hiring me.

Re:The Time Needed to Write “Effective Modern C++” by easytiger on Thursday April 23, 2015 @09:39AM (#9426550)
Makes literally no sense. The c developer would simply use the same c/fortran library the python implementation is based on. You are creating a false dichotomy for the sake of it.
Re:The Time Needed to Write “Effective Modern C++” by rprospero on Thursday April 23, 2015 @10:18AM (#9426801)
The c developer should use the same c/fortran library that the python implementation is based on. A good C developer would use that library. In my experience, mediocre C developers will not use that library and will implement their own, naive version.
Re:The Time Needed to Write “Effective Modern C++” by easytiger on Thursday April 23, 2015 @10:55AM (#9427129)
This has not been my experience.
Re:The Time Needed to Write “Effective Modern C++” by mreiland on Thursday April 23, 2015 @12:16PM (#9427716)
He's making shit up to stroke his own ego, ignore him.
Re:The Time Needed to Write “Effective Modern C++” by andrepd on Thursday April 23, 2015 @06:09AM (#9425726)
Yeah, I really don't see the GP's point.