btw, JVM is mere a c++ code.
The "C is Efficient" Language Fallacy
81–90 of 127 posts
Re: The "C is Efficient" Language Fallacy
#82Re: The "C is Efficient" Language Fallacy
#83Earlier quoted context omitted.
DSP is one domain where performance of a tiny part of the code (say 1%) is far, far more important than everything else. If you need to apply a filter to remove high frequencies, or if you need a Fourier transform, no high-level tuning or special algorithm will cut it: you need the filter or the transform, even if it's very costly. The bottleneck is real and unavoidable. I work in data acquisition and in this domain…
In this thread people are closely tying C/C++. Is objective-c in the same league?
http://www.oonumerics.org/blitz/ This is what Templates are made for. And this is what you can't do in something like Java or Objective C. Java Generics boiling down to type cast at run time to and from Object, it doesn't help performance a bit.
Re: The "C is Efficient" Language Fallacy
#84This argument is as old as the hills. It's probably true in a lot of niche situations. But the fact is, most C code is faster than higher-level language code, because: * C programmers have more freedom to arrange data in memory to exploit locality * C data structures need less bookkeeping * C programs manage memory manually, and so lack GC overhead * C programs can easily swap in different allocators for different wo…
There's something beyond those figures, though. And it gets worse when a team is involved.
The higher the level of the language rises, the less it allows making bad programs, however big the program is.
Re: The "C is Efficient" Language Fallacy
#85Earlier quoted context omitted.
Right. C is a power tool. You can use it to create something blindingly fast. You can also use it to create something dog slow. I've seen Smalltalk programs outperform C programs. I know of an instance where a coworker benchmarked a C implementation of a block cipher vs. a Smalltalk implementation, and the Smalltalk ran 3% faster. Why? Naive manual memory management in the C implementation.
Another classic HLL vs. C argument: the anecdotal slow C program. Clearly, of these, there are many great examples. Unfortunately, it's a crappy argument, because there are also a zillion incredibly slow HLL programs.
Re: The "C is Efficient" Language Fallacy
#86C works in CUDA and OpenCL - which for scientific programming is the fastest thing there is. The GPU is used with C. C isn't faster than hand coded assembler on cpus... but is pretty damn quick. There are specialist compilers for C, like vector C etc. anyway... whatever. back to typing text into a file now.
Re: The "C is Efficient" Language Fallacy
#87Earlier quoted context omitted.
Another classic HLL vs. C argument: the anecdotal slow C program. Clearly, of these, there are many great examples. Unfortunately, it's a crappy argument, because there are also a zillion incredibly slow HLL programs.
That is a false dilemma tho'. No-one in the Python world has anything invested in a 100% Python solution to anything. Doing the compute-intensive bits in C is in fact expected and encouraged! The same is true in the Tcl camp. Maybe some HLL communities (Java?) like to be "pure" but I've not ever encountered that.
Re: The "C is Efficient" Language Fallacy
#88Earlier quoted context omitted.
In this thread people are closely tying C/C++. Is objective-c in the same league?
No. Objective C isn't performance oriented, and while it's fine for most desktop apps (!) it's not in the same league as C++. C++ can actually let you use higher level structures that are faster than in C or Objective C because of template meta programming, as shown in the Blitz template library for numerical computation. http://www.oonumerics.org/blitz/ This is what Templates are made for. And this is what you can't…
Re: The "C is Efficient" Language Fallacy
#89This argument is as old as the hills. It's probably true in a lot of niche situations. But the fact is, most C code is faster than higher-level language code, because: * C programmers have more freedom to arrange data in memory to exploit locality * C data structures need less bookkeeping * C programs manage memory manually, and so lack GC overhead * C programs can easily swap in different allocators for different wo…
Re: The "C is Efficient" Language Fallacy
#90Earlier quoted context omitted.
C programs manage memory manually, and so lack GC overhead At this point, GC is often faster than manual allocation. (Due to being able to allocate or deallocate a bunch of things at once, rather than having to allocate/free memory whenever the programmer says to.)
You too are committing the fallacy of assuming that "managing memory manually" means using malloc() and free(). Fast programs don't use malloc() directly. Hell, even apr programs have standardized on this optimization. Many GC schemes are probably faster than malloc. But it's a much less credible argument to say that you have a GC that is faster than a custom allocator tuned to a workset. You probably don't.