Thomas Grill wrote:
Martin Peach schrieb:
Marc Lavallée wrote:
Le 21 Novembre 2005 15:08, Hans-Christoph Steiner a écrit :
Assembly is even faster than C, so why aren't people writing objects in assembly?
Because assembly is unreadable, like some PD patches.
...and not portable, you need to write different code for each processor, whereas a C compiler can take c code and make the appropriate assembly from it. So c objects end up written in assembly anyway. The only advantage in writing directly in assembly is if you think you can write better code than the compiler, which was quite possible in the past, but nowadays not so easy.
Well, ever heard of atomic instructions and lockfree code? And how about SIMD?
Well I said it's not so easy...
Would you show me how to code that in C?
I think intel released a compiler that would specifically use SIMD, and I always believed the commercial compilers also used them when asked as part of the optimisation. So whenever you want multiple instruction processing you need to declare variables as arrays of multiples of four and the compiler will optimize as parallel instructions...See this: http://ds9a.nl/gcc-simd/fp-simd-builtins.html I would guess that thread libraries implement the locking and atomicity in assembly so I don't need to worry about it, but I haven't gotten there yet...Possibly future versions of the c standard will include keywords for threading support.
Martin
thanks, Thomas
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list