The End of Native Code?
psycln asks: "An average PC nowadays holds enough power to run complex software programmed in an interpreted language which is handled by runtime virtual machines, or just-in-time compiled. Particular to Windows programmers, the announcement of MS-Windows Vista's system requirements means that future Windows boxes will laugh at the memory/processor requirements of current interpreted/JIT compiled languages (e.g. .NET, Java , Python, and others). Regardless of the negligible performance hit compared to native code, major software houses, as well as a lot of open-source developers, prefer native code for major projects even though interpreted languages are easier to port cross-platform, often have a shorter development time, and are just as powerful as languages that generate native code. What does the Slashdot community think of the current state of interpreted/JIT compiled languages? Is it time to jump in the boat of interpreted/JIT compiled languages? Do programmers feel that they are losing - an arguably needed low-level - control when they do interpreted languages? What would we be losing besides more gray hair?"
We might be loosing our ability to spell the verb "lose".
No, wait, too late.
When your web-based-datastore gets 50,000 inserts per second, hovers between 15 and 20 billion rows and endures a sustained query rate of 43,000 queries per hour, tell me which part of it you want to coded in PHP.
I know what you mean. In Linux, I used tons of music apps like Banshee and Amarok for their features, but got fed up and went back to XMMS for its speed. JIT languages are NOT appropriate for every task.
You're right, I wouldn't steal a car. But if it were possible, I sure as hell would download one!
Didn't we already do this with lisp, like 40 years ago?
As the overhead of interpreted languages gets smaller (through faster systems, JIT, and other optimizations), its inevitable that eventualy we'll all be using one (unless you are one of the few people who have to program the virtual machines, the JIT compilers, etc).
And this is a good thing, because it means more independance from certain CPU architectures.
Someday, you will be able to use any OS on any CPU and any Application on any OS. This is one step in that direction.
-- Senior Software Engineer, Attorney appearance services, locallawyerapp.com.
No, no, obviously, they're loosing grey hair in the same sense that one "looses the dogs" -- i.e. they're setting the grey hair free.
On every computer I use with Windows it takes up to 20-30 seconds to launch Java. Web page have a little "yes, you have Java" applet? Prepare for a massive slowdown. I'd hate to see what it does with applications that may just appear to hang the computer while Java launches. And don't get me started on taht stupid "Welcome to Java 2" dialog that pops up from the taskbar.
Now on my Mac, things are different. Java applets launch just as fast as Flash if not faster (basically, instantly). This is on my G4 so things would only be better with a CoreDuo. Same goes for applications. I've been using an appilcation called YourSQL for over a year. It accesses a MySQL server and works great. It's very fast, has a perfectly native interface. You would think it is a native app, but I recently discovered that it's Java. The end use would NEVER notice that kind of thing except I was trying to debug a problem in my own code so I went to invesitage how it worked. It was Open Source and when I downloaded it... it was Java.
Java is fantastic on Mac OS X. I don't know how fast it is on Linux. But as long as there is a 20-30 second launching penalty on Windows, Java will never be accpeted. I don't think .NET has this problem, but probably because MS is keeping it memory resident in Vista even if no one is using it.
Then again, maybe Mac OS X preloads Java. I don't know if it has tricks, or if the Windows implementation is just that bad.
Comment forecast: Bits of genius surrounded by a sea of mediocrity.
At this point, there is still a lot of development happening in "native" languages. Additionally, there are projects in motion to turn bytecode from environments like Java and Python into native code. One of the reasons a lot of people are seeing this seemingly massive movement is because of the technologies these "non-native" solutions leverage. Take both Java and .Net - the support libraries are huge and designed to (more or less) work together.
All of that said, I'm a bit sick of either having to put up with the limitations of some of the languages that end up as native code or distributing some runtime environment with my app that immediately gives my users an impression of my product. For that reason, I've started to use D - http://blogs.itoperations.com.au/chris/software/la nguages/language-choice-is-a-compromise/. If you can't be bothered reading my convoluted blog (there's more coming on the subject, along with a project release in coming weeks), go on over to the language's home - http://www.digitialmars.com/d/index.html. It has the vast majority of C++'s features (and more), Java/C#-style syntax and ease whilst compiling to native code.
You're going to get a lot of the same sort of responses now - lots of people arguing about a requirement that these non-compiled programming languages aren't suited for. Every language has a different purpose when its creator(s) decides what direction to take.
Death by snoo-snoo!
The old saw is to not optimize until you have to. Write in an interpreted language, but be ready to dive into native code when the need for speed arises.
(a) 'loosing': oh jesus christ
(b) the obvious answer is that native vs interpreted is basically simply the balance of developer cost versus cost of end-user resources (ram, cpu, users time). Interpreted code is getting faster every day, no matter what "OMG JAVA IS SO SLOW DUDE" geniuses on the interweb tell you, but there'll always be problem spaces where a 5% speedup pays huge dividends.
there is no need to sign your posts. this isn't usenet. your username is right there above your post. stop it.
It's all bs.
15 years ago I benchmarked assembler vs c for graphics code - c was 200 x slower. There is NO way that any interpreted runtime will even begin to approach the "bare metal", never mind c.
Most of the benchmarks crowing about the speed of JIT compilers ignore the startup and initialization time, as well as the end-run time.
I couldn't believe some of the naive assumptions on one published benchmark - they had the java code print out its start and end time and said "see, only 4x slower than c"; naive is being polite. Proper benchmarking would mean putting a wrapper around both code examples, to handle the start and end time notification.
fun fact: slashdot is written in an interpreted language (perl).
wait a minute, the kid might be onto something ...
there is no need to sign your posts. this isn't usenet. your username is right there above your post. stop it.
They're appropriate for many tasks. Web development is a good example, along with productivity apps that don't depend on speed. An alarm clock app, or post it notes, or other such small things. But apps making use of binary media or requiring extensive math such as a physics engine on a game or an emulator should use native code.
You're right, I wouldn't steal a car. But if it were possible, I sure as hell would download one!
Outside of introspection and like technologies there is no reason why code cannot be compiled natively. Linux users are aware of compiling java code natively, microsoft is working on a native c# compiler, so why is it that everyone else things it's still okay to compile to byte code or scripts. It's not; end of story. I do not like when every new processor that comes out is stomped on by new programs requiring more resources to do the same job. How many java programmers use runtime reflection or introspection? How many programs is it actually needed? If you're not using that, then you should compile natively. Just because Vista is wasting precious resources on it's silly aero glass, etc, doesn't make it right for everyone else too. What happens when someone tries writing a kernel in an interpreted language? Stage 3 bootloaders'll throw us into a JIT environment now. I could just imagine the efficiency there. Native languages are the way to go and we're in for big problems if they don't stay around.
You're right, I wouldn't steal a car. But if it were possible, I sure as hell would download one!
There will always be native code because it is faster. When code needs to perform better, rather than be more flexible, people will always go back to Asm and other such low level languages.
And yet even though c was 200x slower most people now program in C or a "higher" language, why? Portability and ease of use. Isn't that what interpreted languages offer us more of?
Yeah... people keep saying that. Okay, lets take the benchmark I hear about most: http://kano.net/javabench/ "The Java is Faster than C++ and C++ Sucks Unbiased Benchmark". Unbiased my foot. "I was sick of hearing people say Java was slow" is not a good way to start an unbiased benchmark. Lets have a few more problems:
Y'know, I think there's a reason for that...
Y'know, a couple of decades ago I was running non-native applications on a 7Mhz system with 1MB RAM (my old A500). They were fast, but not quite as fast as native. I'm now using a system in the region of 500 times faster, in terms of raw CPU, and with 2,048 times more memory. And y'know what, non-native stuff is fast, but not quite as fast as native. Something about code expanding to fill the available CPU cycles, methinks...
Of the development I do, about 60% is in non-native code (mostly java) and about 40% is in native code (usually C++). What I have found is this:
Java is the language I use the most, and it's good for small programs. It's definitely noticably slower for large applications, but I don't think that's the big reason that a lot of developers don't like it. Swing is nice, but the problem with Java and a lot of other "modern" languages is that they try so hard to protect the developer from themselves and enforcing a certain development paradigm that the same features that make it really nice for writing small program end up standing in your way for large and complex application development. Looking at the other side of the issue, C++ is fast, it can be fairly portable if it's written correctly, and has a huge amount of libraries available. C++ will let you shoot yourself in the foot, but the reason is that it's willing to stand out of the way and say "oh really want to do that? ok...". This makes it easy to write bad/buggy programs if you don't know what your doing, but if you pay attention, have some experience, and a plan for writing the software, then C++ can be less stressful to develop.
Aside from a reasoned argument, I think a lot of developers are just attached to C/C++. I know that I just enjoy coding in C++ more than in Java. Not that Java is bad- and it can be fun to code in at times, but the lower level languages just give me more of a feeling of actually creating something on the computer- as opposed to some runtime environment.
Finally, one major reason to stick with C++ is that many interpreted languages aren't really as portable as they pretend to be. A language like C++ that really is only mostly portable, and then only if you keep portability in mind, can sometimes be more portable than other languages that claim to be perfectly portable and then make you spend weeks trying to debug the program because things are fouling up.
Famous Last Words: "hmm...wikipedia says it's edible"
Overall, I think the answer is yes. As far as .Net goes, there are a lot of advantages to having libraries and applications in a format that can be just-in-time compiled or pre-complied to native code on installation. Certainly, for MS it is a big advantage, as they don't have to target a lowest-common denominator of CPU features. Another advantage is that .Net does have pretty decent interoperability with native libraries. So, if you need the native performance, you can use a native library to try and gain some performance back without going totally native.
.Net to precompile libraries to native code. Used correctly, it can improve cold start times.
As for Java, I think it has a couple of issue that gives it a bad impression. Certainly, it's integration with native code could be improved (JNI is pretty hairy at times). Also, it seems that the current JREs don't have a lot of native tweaks to increase startup time. Certainly, I think Java could use a utility like ngen for
The choice of language does not determine if something is cross platform. It has more to do with the choice of toolkits. If you are using GTK or wxWidgets you are pretty safe for being cross platform. C/C++ are cross platform languages, but if you use MFC and COM, they're not.
Even if I use Java or C#, but don't use a cross platform toolkit (e.g. Windows Forms would not be cross platform), the application won't be cross platform.
It doesn't matter if the language compiles to byte code, if that byte code doesn't use a cross platform toolkit, it won't be cross platform.
Things you think are in the Constitution, but are not.
Well, server-side applications and client-side applications are, quite arguably, different sorts of programs.
For heavy number crunching interpretted is not there yet. Then again compiled code is not great for everything either, sometimes you have to write hardware specific assembly code. On the other hand if you are doing something that spends more time waiting in the user than actually working, then an interpretted language is great. Like everything you need to make a choice when you are going to use one approach or another. Remember you want to get a program out of the door and making it available to as wide an audience as possible so you will write in the language that is best suited for the task. If you know where to delegate the heavy number crunching then you can spend the rest of the time making a great program. Look at some of the programs written in Java using OpenGL. They are fast, but that is because they hand off the necessary heavy lifting to low-level APIs, heck even compiled languages like C/C++ do the same. See here for example: https://jogl.dev.java.net/
Jumpstart the tartan drive.
Mac OS X treats Java as just another app framework, equivalent to Cocoa or Carbon. (I'm fairly certain I've seen an older version of that diagram that also listed Classic in that layer.) I imagine they've done a bunch of optimizations to tie it into the system, though I don't know whether it launches the runtime at boot or not. You've probably noticed that on Mac OS, you get your Java runtime from Apple, not from Sun or IBM.
The downside is that things don't work quite the same as they do in Sun's Java runtime, so there are differences between Java-on-Windows and Java-on-Mac. For instance, my wife is an avid Puzzle Pirates player, and the game client is a Java app. There've been Mac-specific bugs in the past, and at one point a major slowdown appeared when the game was run on a Mac. It hasn't been fixed, so while she can still do crafting on the Mac, whenever she does anything multiplayer, she has to switch to the Windows box.
I am not expecting to be loosing arrows from my bow any time soon, but I am hoping that the /. editors can stand to be losing some O's from the summary. :)
Maybe you sucked at writing C. I can't imagine that huge of a difference in performance unless you really just did something wrong. That could include choosing a bad thing to benchmark (Maybe something that triggered a compiler bug?).
I hate grammar Nazi's.
And wtf is "loose"?
Silly question. The answer is and will always be: No.
Commodore 64 BASIC was interpreted. Computers now are obviously powerful enough to run 64 BASIC code very quickly. Does that mean native code should have been abandoned years ago because technology advanced enough to allow C-64 code to run quickly? JIT code will always be slower than native code and because the complexity of both JIT and Native code programs will get more complicated as the technology advances interpreted code can never catch up.
List of things you cannot loose:
- your gray hairs (unless you can command them somehow)
- control
- the big game
- your way
List of things you could be loosing:
- the hounds
- your belt
- an arrow
- responsibility
Did you ever notice that *nix doesn't even cover Linux?
~ $ file /usr/bin/amarok /usr/bin/amarok: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.6, dynamically linked (uses shared libs), stripped
/usr/bin/amarokapp /usr/bin/amarokapp: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.6, dynamically linked (uses shared libs), stripped
~ $ file
amarok-1.4.0/amarok $ ls src/
*snip* a bunch of C++ source and header files.
Come again?
Sticking feathers up your butt does not make you a chicken - Tyler Durden
I don't see the part where he says "they aren't very good for ANY client-side tasks". And more and more traditionally client-side applications are moving server-side, what with this new-fangled interweb and your ajaxes and such and such.
there is no need to sign your posts. this isn't usenet. your username is right there above your post. stop it.
Now find me one CPU that can do a decent simulation of the physics of continuous media. Why isn't there any game where you ride a surfboard realistically? Why do meteorologists use the most powerful number crunching systems in the world to be wrong in 50% of the cases when predicting weather a week ahead?
And what about artificial intelligence and neural networks? Find me a CPU that can do a decent OCR, or speech recognition. What about parsing natural language? Why can't I search in Google by abstract concepts, instead of isolated words?
No matter how powerful CPUs are, they are still ridiculously inadequate for a large range of real world problems. When you go beyond textbook examples, one still needs to squeeze every bit of performance that only optimized compilers can get.
I'll give the parent post the benefit of the doubt. The article text is worded in a way that strongly suggests client-side.
I took java last spring for a MIS course and I was expecting the usual slow load times with things like netbeans. The class was taught with java 1.5 and I noticed it was fast. All the java applets just loaded including the java programs netbeans on my system.
Oddly I wondered why Azuerous and frostwire seemed to not be that slow anymore as well. I figured I just assumed java didn't suck as I thought it did.
Now I know why.
For the slashdotters reading this, I highly recommend upgrading to java 1.5 on your machine. You will certainly notice a speedup as I did.
http://saveie6.com/
Think. As one example, the compiler makes assumptions about registers that I'm free to ignore. Ditto with pushes and pops, etc. There are shortcuts you can take in assembler that you can't in c. It doesn't get any faster than assembler. and assembler is probably the most beautiful language to work in, because its what YOU make of it.
Don't you hate that answer?
Yes, we are seeing more development in non-native code but, it gets it's power from the underlying libraries and core code that is native. The line between them gets fuzzy when you toss in JIT and scripting to native code compilers. It really depends on the problem area. If I'm just parsing apart a bunch of log files to make reports Perl or Python would be the best. Web apps seem to benefit from the safety net of non native code but I'm sure there are exceptions.
OTOH there are plenty of apps that need all the speed and memory the machine can provide. My current job involves real time financial data delivery. Writing that in Python or Java would (probably) not work out too well. OS code that works directly with hardware will probably stay in assembler or C. Fast low level stuff is what allows the slower high level stuff to be useful.
Either way you still need to know what you're doing because in the end both native code and interpreted code run as opcodes on a CPU and use hardware resources. You need to mind memory use in Java just like C. Just in different ways. You've need to watch what you do in inner loops in both Python and C++. Linear lookups can cause scaling problems in Perl, Java, Python or C/C++.
It all depends on how fast you want to get from problem to solution, how much hardware you can throw at it, how complicated the problem is, how much time you have and many other factors.
Languages are tools, not a religion. The broader your knowledge the more tools you have at your disposal. Pick the best one for the job at hand.
The obscure we see eventually. The completely obvious, it seems, takes longer. - Edward R. Murrow
Ok, assuming the post isn't flamebait... This issue keeps coming up. A good programmer should understand that the language choice depends on the task at hand.
If you're making a pretty GUI, you may want to use an easy-to-use and portable language and may not care about performance as much. If you're creating a high-performance backend, or doing some realtime processing, an interpreted language is practially useless.
Before deciding which paradigm is superior, you must narrow down the question to a type of task. Since the variety of tasks we use software for does not seem to be shrinking, it seems that this issue will not be resolved decisively anytime soon.
BASIC had its problems, warping a generation of programmers (including me), but it was small and light and didn't take long to learn unless you wanted to enough find tricks to get real work done.
FORTH was smaller, lighter, and faster. It was overly self-important, considering its reinvention of the subroutine to something new and radical, but if you wanted to program toasters or telescopes it was the language to use. Postscript was somewhat of a Forth derivative.
P-Code was a nice portable little VM you could implement other things on.
And then there was Java, which grew out of Gosling's experiences with NeWS, a Postscript-based windowing system. If you wonder why you're not using Netscape and maybe not using Java, and why you've probably got Windows underneath your Mozilla, it's because it became obvious to lots of people that Netscape+Java was a sufficiently powerful and easily ported environment that the operating system underneath could become nearly irrelevant - so Microsoft had to go build a non-standards-compliant browser and wonky Java implementation and start working on .NET to kill off the threat. It wasn't that conquering the market for free browsers was a big moneymaker - it was self-defense to make sure that free browsers didn't conquer the OS market, allowing Windows+Intel to be replaced by Linux/BSD/QNX/MacOS/OS9/SunOS/etc.
Bill Stewart
New Fast-Compression-only CPR http://preview.tinyurl.com/dy575ks
This isn't necessarily good for the processor market, because it makes everyone stick to the same standards, even if they're ineffiecient. Oh cool, Company X has designed a processor with a cool new feature that will make programs wayyyyy faster! Oh wait, there's that darn high level language, too bad it'll never be used. Of course, it may be beneficial, because people's progress would be channeled into one direction, however this is only useful for so long, before true innovation almost comes to a standstill.
Just my $0.02.
The problem with the VM startup time is that a lot of code nowadays is "glue code". A small app starts up, shells out to another one to do a task, takes the returned data, shells out to another one .... all those new VMs get expensive.
the workaround is worse - 1 VM that starts up and never quits, just hosting each new process. In other words, 1 bad process can now bring all the processes down, so you have to add even MORE code to check that's not happening. Sychronize is already hugely expensive in Java ... this will add a whole new layer of "things to check between code points". The speed gains won't materialize, as the checking that has to be done increases faster than N+1.
I'm a Software Engineering Consultant who works in the avionics industry. While the enterprise application market may be moving that way, avionics certainly is not. I program about 80% C code, 15% C++ (helper apps), and 5% Assembly Code. The cost involved in certifying any sort or interpreter or JIT compiler is not worth it to anyone doing saftey critical RTOS work. Any speed in application development would be offset by several orders of magnitude in the effort to make that language available to the embedded platform through a certification process which would likely take a large team of developers several years. And maybe by then the cost of the hardware will have dropped enough to support it. Right now the product I work on has 512kB of Flash and 1MB of RAM, and it runs on a ultra low power 20MHz processor.
But for all you folks working in the application sphere, I'm sure things are heading that way as portability becomes a larger issue between OS's and architectures as the market moves away from a Windows based x86 monoculture. But for those of us working on products that include hardware, extra cycles aren't in the budget since they drive up the per unit cost.
... there's no time to loose!
(or is that "there's No-Time Toulouse!")
The one edge that naitve code will always have over interpreted code is that naitive code can just be loaded and fed to the CPU. An added concern is that most comptuers are doing more than one thing at a time. If all the CPU had to do was interpret one program and run it, that would be one thing. But if the CPU is trying to run 5 or 12 apps, and it has to interpret more than one of them, then there will be a bit of a logjam.
END COMMUNICATION
Amarok is native, but still hideously slow (and crashes a lot). Bashee is a C#/Mono app. Quod Libet, another good example, is a Python app. Point is, a lot of modern media apps are written with features but not performance in mind, and many of them are done in interpreted languages. The kings of all music apps, iTunes and Winamp (or XMMS for Linux) do not suffer from the said performance problems.
You're right, I wouldn't steal a car. But if it were possible, I sure as hell would download one!
You seem very self-impressed. Fifteen years ago, before you were senile, I'm sure your benchmarks were of reasonable conclusions. Your C skills must have never been much to flaunt if they were compiling to a result 200 times slower than the "bare metal". I'm hoping for your sake that was exaggeration, but somehow I doubt it. The harsh reality is that working years of brilliant minds have pushed forward to develop compilers capable of pushing out code that would put your best work to shame. Optimizations you likely haven't thought of are regular passes in modern compilation.
JIT techniques, much like compiler optimizations, are developing day by day. Efficient caching techniques and dynamic recompilation and optimization are paving the way to an era of practical programming where an interpreted programming language can present comparable speeds to match against its compiled predecessors.
Like an old man harping about the "good ol' days", you are simply blinded by your years of experience and afraid of change. You cry "naivete" with respect to those who even suggest that there may be performance merits to interpreted languages while showing very little real-world modern figures or statistics. Naive! Naive! Naive!
Friend, blindly disregarding established JIT theory or advances in interpreted programming language performance sounds fairly naive to me.
Write in an interpreted language, but be ready to dive into native code when the need for speed arises.
OK, I'm developing for an 8-bit NOAC (6502 based) microcontroller clocked at 1.8 MHz. Does the need for speed arise here?
Eh, sorry. Assembler is as beautiful as truck diesel engine. Raw horsepower, but rather useless in a Ferrari. If you want to see a beautiful programming language, how about one that allows one to express code as data?
"All you have to do is be fragile and grateful. So stay the underdog." Chuck Palahniuk, Choke
Interpreted & JIT languages are "within a constant factor" of native code's speed, and CS students are taught that such things don't matter. ;-)
And for many types of apps, they really don't. Ten times slower than instantaneous, is instantaneous.
But people use computers for lots of things, and believe it or not, some of those things are still CPU-bound, and take so much work that humans can perceive the delay. Your word-processor is 99% idle so surely it doesn't need to be native, but you know that somewhere on this planet, a poor shmuck is staring at an hourglass icon, waiting for a macro to finish. The real question is: who cares? Is that guy's time worth more, or is the programmer's time worth more?
As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
You got your car analogy backwards. Assembler is like a Ferrari: it's fast, but hard to get work done with. Other languages are like the diesel truck: they're slower, but their power lets you get stuff done.
One of the neat things was te 4k graphics demo contests - try to write the most impressive graphics demo with only 4k of assembler. There was a LOT of code writing code in memory, code using other code that had already run as raw data for designing the next iteration, then using it again as code ... a 4k program that could take you through a 3-dimensional roller coster ride for 20 minutes, never repeating, all done in real time, on hardware that you wouldn't deign to pick out of the scrap heap.
Chances are there will always be both...the only one that can die is interpretters... Heres some reason why: -You cant write an operating system in an interpretted language... -There are some things you can only do in a native language, and interpretted language have the easy portability thing going on for them... -Interpretters have been around for a long time and they arnt going to go away any time soon You cant think native code is going to be dead just because someone makes a popular interpretter...there are just some things an interpretter cant do... Besides, ASM is so awesome who would ever want it to go away...:P
Anyhow, you give me the magic for, e.g, parsing natural language and I guarantee you that even if you take a 20% performance hit for running the magic in Java instead of assembly it won't matter as I can always buy more iron and if your magic actually does what you say it does I'll have money to spare.
Help poke pirates in the eyepatch, arr.
I was right with you until you started gushing about the beauty of assembly. You might be able to write a single, heavily-used subroutine in assembler, and make a thing of beauty out of it. But the moment you try to do something truly ambitious, you abso-friggin-loutely need layers of abstraction. CPU cycles are one thing you don't have an unlimited amount of. Brain cycles are another.
You want the truthiness? You can't handle the truthiness!
Firstly, the compiler doesn't spit out C. It spits out machine language, the same thing your assembler spits out.
In this day and age, the compiler is probably smarter than you are. It can be told which processor your executable is targetting and use its instruction set as appropriate. This is particularly important for x86 chips, as there have been a number of SIMD extensions added to the instruction set in the last 15 years.
15 years ago, 3D graphics on a computer was unheard of. Now, they are ubiquitous. Programming 3D graphics is theoretically possible with assembler, but it is a much better idea to use something like C and an API like OpenGL.
GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
People who use "loose" when they mean "lose" are real luusers, aren't they?
Good, inexpensive web hosting
One of the oldest analogies in computing is comparing algorithms to cooking recipes. We even have books like "Numerical Recipes" and "Perl Cookbook".
Well, to me, interpreted languages are like frozen dinners. They will do if you come home late at night and are too hurried and hungry to cook a proper meal. But C is like a fully equipped kitchen. It takes *much* more skill to cook a proper meal than to heat a frozen dinner in a microwave oven, but the results are incomparably better, not to mention the pleasure you get from doing it the right way.
If we all quit using native languages, then what are we going to use to a) write embed code, b) write drivers, c) write operating systems and d) write the interpreted languages that we use to replace our native ones?
Does anyone remember USCD UCSD P-SYSTEM?
The sun/microsoft handling of Java and Java standards did nothing to help its adoption.
.net/mono
Yet, it seems Java is one of the most used languages.
This web site, http://www.tiobe.com/index.htm?tiobe_index (seems to be in netherlands and uses search engines to calculate the ratings) lists:
1- Java 21%
2- C 18%
3- C++ 10%
I use C++, and although that's x-platform, its usage is Windows specific (COM, ATL, etc). That's because I don't need a Mac/Linux version of my software. IFF I did, I'd have to either
- manage my C++ abstractions more carefull to avoid os dependencies
- use Java
- Dare I say it,
If I had to make some crystal ball 4 year look ahead, I'd say the MS os dominance will increase the use of JIT languages, especially with the runtimes being included in the os (Vista).
C++/CLI, there.
http://superconfigure-supergroove.appspot.com/
You know, you try to be patient. After all, a lot of people are not native English speakers, but this "loose" thing has become extremely common, and it's only been in the last two years or so. I've been seeing "alot" and "rediculous" all my life, but the "loose" thing is some kind of evil meme-virus which is spreading because, and this is the only reason I can imagine, the people who spread it don't read anything that's not written by some other semi-literate luser on the Internet.
/. and digg is ridiculous. The scary thing is that I would imagine a high proportion of these kinds of folks, being computer nerds and all, are reasonably well-educated, yet they still write like Mrs. Tuberglotter's 6th grade remedial reading class.
I'm hardly the most well-read person on the planet, but the general level of spelling and grammar around places like
You are in a maze of twisty little passages, all alike.
- Write it in c
- Embed optimizations in c function calls
- If really anal, replace all the function calls with macros to call each routine directly.
After all, once you've completed step 2, you more than 95% there anyway... and only a compiler can write code to use SIMD extensions? You forget history - that originally, it was people abusing the fpu (in assembler) to have it process multiple chunks of data with one instruction that gave rise to SIMD extensions, formalizing what was already going on. We're seeing the same thing again, with people using the gpu on graphics cards to process non-video data.
The main thing is that the optimized compiler can tirelessly work on millions of lines of code, doing a good job of fully utilizing the hardware at each point, whereas the human assembly language coder will peter out juggling registers after few hundred lines of code. Past that point, the human coder will start creating manual layers of abstraction (subroutine calls, assembler macros, etc.) that just don't get optimized at all.
After you've written your graphics masterpiece and gotten it fully debugged, then you can profile it. If you can then identify some inner loops that you can't fix up by tweaking the C code, then maybe you should write a few dozen lines of inline assembler code. Anything beyond that is likely to be an unportable, counterproductive waste of effort.
I think they might have meant USians as apposed the the THEMians.
Just my thoughts as i wing it through this world. Don't give them too much credit.
We win together or suffer without.
loosing != losing
Native code isn't dead. It's just that all the native compiled languages have failed to keep up with much-needed language features for web development purposes and have shown a serious lack of resiliency in the face of security attacks.
C is a lot easier to debug, is dramatically faster, and gives the developer a lot more control over memory allocations, which can result in orders of magnitude performance improvement when you start running into paging stress from poor garbage collection in Perl or PHP. Sadly, all those benefits are only helpful if you don't have to spend days debugging some buffer overflow bug. or trying to figure out why some random function in a library that will remain nameless returns NULL out of the blue (with no error codes).
I'd go so far as to say that if it weren't practically impossible to write good CGI code in C, we'd see PHP and Perl use on web servers drop off substantially. Right now, string processing in C is fragile. It's far too easy to make mistakes and end up with security holes due to buffer overflows. Also, C completely lacks any clean mechanisms for doing variably-sized arrays, in-memory hash tables (as opposed to hash(3) for database files), etc. in the language. You can extend C++ to support these things, but AFAICT, there isn't really a language standard in place for them.
I would love to see a nice, clean standard set of variable-length string and associative array libraries with these features:
If I could find such a thing, I'd probably still write all my CGI programs in C instead of only writing the most performance-critical pieces in C. As it stands, it's enough of a pain to make C CGI code work correctly that it isn't worth the trouble for me, and so I suffer the performance hit (generally of PHP).
Check out my sci-fi/humor trilogy at PatriotsBooks.
take a look at GNUStep Web, the FREE version of WebObjects. It's Objective C but otherwise satisfies most of your criteria.
Do you even lift?
These aren't the 'roids you're looking for.
Software will always expand to fill available resources with useless secondary gimmicks. I mean, look at Vista and its requirements. You would hope that when purchasing a PC that the available resources you are paying for will be used by applications you use. Instead, looks like the OS will be eating most of that up. It is the operating system's job to facilitate applicatons' access to resources, not to squander them on mostly useless (although arguably pretty) features.
I guess we can call that the new peter principle - every piece of code rises to its coders level of incompetence :-)
Every year we hear stories about how c is dead, but its still alive and kicking. The "java chip" that the Java OS was supposed to run on never materialized. Various other managed languages are either unmanageable (hello, perl! - sorry, had to throw that one in) or just can't compete on speed.
What's the BIGGEST problem with c? Buffer overflows and forgetting to free memory. These are both the same problem - somebody making a mistake in their code. Its not the language's fault - its the programmers. Falling back to managed languages because people are too lazy to check for corner conditions just promotes bad code in general. If you don't have the discipline (and curiosity) required to check for corner conditions, you don't have the discipline and curiosity to write good managed code either. But that's just my 2 cents.
After using the "P" languages over the years (Perl, Python, PHP), I still find c to be my favourite (probably because I really like the preprocessor).
Is PC133 SDRAM still available for purchase at a reasonable price? Or should I buy a whole new computer instead in order to take advantage of various flavors of DDR SDRAM?
I don't run real-time anti-virus or anti-spyware. I start the periodic check and then go eat dinner, and I use safe hex methods (including Mozilla technology and a NETGEAR firewall router) to not get infected in the first place.
These days I program mostly in Java / C# with occasional quick-n-dirties in PHP. However, for system programming you'd want something low-level like C (or even assembly). For an OS, compilers, assemblers, drivers, or anything real-time you'd want a non-interpreted language. Same goes for the interpeter (like a JVM) or a JIT.
And before you say hardware support for interpreted language - do a quick search on Japan's fifth generation project.
[Insert pithy quote here]
HD video (1920x1080, rgb, 30fps) is 186 megabytes per second. Processing that with an interpreted or even JIT language is going to be many orders of magnitude slower than hand-coded C, or GPGPU, or whatever the flavor of the month is. Yes python and ruby are super productive. But my time writing the code is only spent once; the poor schmucks out there using it will be using it every day for years.
People doing HD postproduction really care about every cycle per pixel because the factors are so large: if you can turn a overnight render into a lunch-hour one, or lunch hour into a coffee break, or coffee break into near real time, that matters a lot. That time to the video guy is what the edit-compile-debug loop cycle time is to the programmer.
--ST
Misconception #553: The Intel C++ compiler costs money for hobbyists. Fact: Intel distributes its C++ compiler for free under two conditions: compilation must be for non-commercial use and you don't get committed support. Given that these are 'hobbyists', then these are perfectly reasonable requirements. See http://www.intel.com/cd/software/products/asmo-na/ eng/compilers/clin/219856.htm.
When I run so-called-compiled code under an emulator like Bochs, *poof* it's no longer native. In theory, it can be very managed if the emulator is capable of doing sophisticated things like moving threads around virtual processors based on the potentially-changing resources available on the underlying host environment, adding processors or memory on the fly (assuming an OS that supported such things), etc., things clearly beyond the abilities of most "native" PCs.
The reverse is true if I pass my java source- or byte-code through a compile-once/not-JIT "native" compiler. Managed code suddenly goes native.
I predict people will work in the environment that is most efficent for them, where efficiency takes into account development costs, maintenance costs, run-time costs, political costs, etc. etc. etc.
There's also the question of "what exactly is managed code." If your program compiles against an exception-handling library, as most large programs today do, is that not a primitive form of code management? Granted, you may have to write your own management layer, but it's still not totally unmanaged. Even running as a process in a modern OS is a form of management, since a fatal-to-the-process error can invoke OS-level clean-up routines to close files and return resources.
To borrow from Shakespear: Managed or unmanaged, that is the question.
The answer depends on your perspective.
Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
I think things may start going the way MS is pushing with C#: Managed apps with unmanaged parts. I mean after all, is a UI really going to get much faster in native code than the .NET runtime? Even if it is, would you notice? Ok so code the UI part all in a managed environment. Then, code the time critical stuff in a language that compiles natively and hook the two together (VS does a great job with this). You get the speed where you need it, but the advantage of easy coding for most of the project.
I could see that becomming popular.
No, just the factor of 200 can't possibly be attributed to only one factor.
I hate grammar Nazi's.
I've got to admit I find the current methods of handling web server code to be a screw-up.
Either have a runtime VM and create a new context for the classes, load your classes into the VM, and dump it all on each page call, or have a module and initialize it for each page, load and initialialize your script, run it, and dump it on each call.
Still, it can't be any worse than my old c cgi routines ... server runs the cgi, cgi reads from stdin, performs the work, writes to stdout, server passes stdout to the client machine ...
I didn't bother benchmarking, but it just seemed faster (the routines to access mysql in c aren't that hard to figure out, and you can test the whole thing from the command line, just like any other cgi). Maybe that'll be a project for a weekend.
fun fact: slashdot is written in an interpreted language (perl).
...
wait a minute, the kid might be onto something
I'm not sure how funny vs serious you're trying to be, but slashdot uses mod_perl which only needs to compile the scripts once, and then runs them very fast after that. Kinda like fastcgi, but I haven't heard of fastcgi in quite a while.
Thinking back a few years, iirc the first Apple Mac had the Quickdraw graphics package written in machine language, didn't it? Not assembler, but instructions made of hand-mapped binary digits. It's the reason why those early Mac GUI's were able to extract such amazing graphic performance out of the Motorola 68000.
You can still buy Zilog Z8's, and embedded applications still exist for them.
Do not mock my vision of impractical footwear
You cannot hope to have interpreted code running on different architectures with the hope that it runs indentically on each architecture. The point is that native code (and programmers writing such code) take advantage of architecture specific features.
For example, look at the floating point unit on the x86 architecture. It supports 4 kinds of rounding modes (round to nearest even, round to positive infinity, round to negative infinity, round to zero).
If someone were writing a scientific application, the possibility that he needs to change the rounding mode of the CPU could arise for various reasons. Such a task is simple in languages such as C.
Java however does not support any rounding mode other than round to nearest even. The reason for this is that some architectures do not support multiple rounding modes (that may be false, since the rounding modes are part of the floating point standard, and any architecture that supports floating point *should* support them), and therefore supporting architecture specific code would make it not portable, defeating the purpose altogether.
-David the Great (www.scurvydogs.org)
We wrote the same search engine code in 4 languages, PHP, ASP, C++ & JavaScript. The results are published here, http://www.wrensoft.com/zoom/benchmarks.html
In summary, C++ was 4 times faster than PHP, and in turn PHP was 3 times faster than ASP and JavaScript was truly appalling. I can't think of many applications that wouldn't benefit from being 4 to 12 times faster.
Half of what you want is in the C++ STL.
And no, the STL does not suck.
In my opinion, the real advantage to bytecode is nothing more than ease of distribution. With bytecode and virtual machines, you don't need to worry that one of your boxen is a Mips processor, another one is running a Sparc, and the gaggle of other boxen are x86es. It also allows for much easier sandboxing. However, Bytecode loses a fair amount of speed, slows down loading time, gives no extra amounts of safety, and is, in general, compiled while it's running anyways (Just In Time compilation). Additionally, for most applications (not applets), sandboxing is disabled. The runtime checks may just as well be inserted into assembly code directly, rather than checked by a virtual machine. Even binary code can be created during runtime and executed from compiled code (well, unless you enabled W^X in the OS, in which case a VM is a way of cheating and working around that security). As a matter of fact, this "generated code" method is used from within Gnu C for closures (nested functions that can reference the enclosing scope). In my opinion, any program tied to a single machine for most of it's life (eg: something that would run on Windows .NET) should probably be compliled, since there is absolutely no advantage to a virtual machine. For things like Java applets, I can see a purpose.
now native code must execute a small fraction of instruction numbers for the same task. Less instructions means less energy. As hardware vendors strive to lower the chip power, the pressure to cut energy bill may one day fall to the shoulder of software guys.
Remember the 90/10 rule - your application will probably spend 90% of its time in 10% of the code.
Once interpretters are fast enough for UIs to be first class, it makes sense to take a hybrid approach. Implement functionality in the interpretted lanugage and then override that critical 10% of the code (or whereever your critical execution path is) with native versions.
"It is our blasphemy which has made us great, and will sustain us, and which the gods secretly admire in us." - Zelazny
Well, of course Vista uses more power than any one interprited language! After all, it's written in C# running in an interpriter written in Visual Basic 6 running in a copy of Windows ME on an 8088 emulator written in Smalltalk using the old Alto runtime in an Alto emulator on a PDP-11 emulator running a port of Exec-8. The PDP-11 emulator is written in an analgram of Java and QBASIC on UAE. And, of couse, the base system on which UAE runs is Xenix with the Microsoft Bob enhancement pack.
How to enable garbage collection on a system without protected memory: #define malloc() ((void *) rand())
That's rubbish. I can get over twice the performance of GCC on palette-based video blit on PowerPC. GCC wastes far too much time performing loads and stores. It can't think like a human. I wouldn't write a whole app in assembly language, but it's worth it for small, performance-critical parts.
I am a Pascal programmer from ancient days and have been pretty much a Delphi person on account of my Pascal affinity and other requirements, but I have implemented GUI apps in C++, C#, Java, Matlab, and VB. I am seriously looking at Java/Swing as the next wave of what started as DOS/Turbo Pascal and got reimplemented in Windows/Delphi. Java simply couldn't do in 1997 what I was doing even at that time in Windows, just plain couldn't from the standpoint of features and performances. Java is not-quite-there-yet with the features I use in Windows, but it is much farther along in 2006 than in 1997 and is closing the gap with graphics acceleration and other features. It may surpass Delphi for what I do if it proves to be easier to do multi-threaded apps to take advantage of multi-core.
While my complex data visualization stuff is a long way off from being done in Java, the sort of simple data visualization stuff that I was doing in 1997 under Windows works quite well under Java, and it works equally well under Linux. If anything will get me to switch to Linux it will be that I have a collection of graphical data visualiztion programs for the work I do written in Java that will work equally well under Linux. While I can write a faster program with more features in Windows, the Java implementation is proving good enough for a lot of stuff that I am doing and it breaks me loose from Windows as well.
SUN seems to be in this Java business for the long haul, seemingly spinning their wheels making it available for free and always being a step behind Windows in features. But at some point Java/Swing programs will have accumulated enough performance and features that they are good enough for what people want to do, and they have the added advantage of not being tied to Windows. This idea that something like Java could transcend the OS may yet happen for client GUI apps.
Hey, I learned a lot in Mrs. Tuberglotter's 6th grade remedial reading class! I liked it so much I took it three times.
Do not mock my vision of impractical footwear
Although Interpreted languages are running faster then ever, this is proportional to the speed of native languages, which are inherently faster by nature.
By the end however, if EVERYTHING turns into interpreted people will no longer whinge that they need to find the version for their OS, they have to go off and download the interpreter the developer decided to use, make sure its up to date, and make sure they get the one for their os (because an interpreted interpreter would be slow). You could say that once you have all the interpreters you dont need to worry, but do you??? You need to keep them updated, you now get bugs in the programs you use AND in the interpreter it uses, etc.
Yes i know interpreted languges are useful, but they will never fully replace native coding.
Back in the days of MS-DOS and 5Mhz 8088 CPU's with 640M of memory Advanced Voice, the company I worked for, ran an 8 port voice mail on an XT and it worked just fine. Matter of fact, when the ultra-fast 8Mhz and 12Mhz 80286's came out we ran a 24 port voice mail that worked great. The interesting thing is that every one else was trying to run C-coded voice mails, and struggling like hell to get them to work, our stuff just chugged along like the Energizer Bunny. And what was it programmed in? PC-Bus, aka Datapoint's Databus, an intrepreted database language. The actual source code is compiled into bytecode, which is intrepreted by a runtime interpreter. Note that 1CTI, the company that now uses that code, still runs it and it's evolved additions, except they're now compiled/run using the Sunbelt PL/B compiler/interpreter. Note that there are two versions, one for Windows and one for Linux. The basic code is the same, the difference being one uses Windows calls for some specialized stuff and the other uses Linux calls. Other than that, the code is the same. FYI, the code is an event-driven single-thread state machine.
The first will always have to be native. It just has to be.
The second will be for a while yet. Any performance demanding app will still care about the blah-percent overhead. Last I checked, my JVM only gets half the megaflops of native code. I want to skip that 50% overhead.
I'm guessing that getting a lot of that overhead back will come from moving from just-in-time compilation to install compilation that can take longer and do more optimizations.
Start Running Better Polls
Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
Lots of people are debating the technical merits of interpreted vs. compiled performance. But the technical reality isn't what drives success. Perception and marketing often matter more.
There is a common belief in the market that native code runs somewhat faster than interpreted code. This means that a product that is native is perceived to run faster than a product that is interpreted, on the same hardware. Is this true? Maybe, maybe not. But so long as people believe this to be true, c-level people making strategic decisions will pick platforms based on their ability to market the product. While there are plenty of times when a product is sold to run on an overpowered systems, there are always customers who want to scale a product to the point where performance is an issue, or who want to be able to scale the product; such customers will shop on performance, and native vs. interpreted can be an issue.
You might find that the D programming language is right up your alley. It seems to match most of your requirements.
and no a compiler is not smarter than you are. There are some amazing assembly code written by people out there that no compiler would ever be able to compile. Of course the compiler does well enough, cause who want to write even 5% of their app in assembly these days?
Being a long-standing member of the computer/console emulation community, I have seen many applications written in native code and some in other languages such as Java. If applications such as these are rewritten in non-native forms, we are looking at the emulation community taking a HUGE hit no matter how fast processors get. The whole point of emulation is the fine balance between compatibility and performance. Programmers who are looking to emulate processor intensive devices are going to use machine code, most likely assembler, to make their creation worthwhile to the average user. Not everyone will have a top-of-the-line processor every year one is released. Some programmers in the emulation world have opted for exact cycle emulation which is already a huge exchange of performance for compatibility. Coding this type of application in non-native form would make demands on the processor increase, causing an energy-saving processor to use more electricity to run an application. While this may not seem to be a concern of an individual, it would actually cost a business with multiple computing units more money in energy usage over the course of a year or so. Some businesses do use emulation technologies in a lot of areas; not all are emulated on hardware expansion devices either.
but at the same time, if your writing code that handles a massive database or a butload of connections every minute, then every bit of performance matters and your probably going to want to get down and dirty w/ C code.
it also depends on what interpreted language we are talking about. From what i have seen, Java under the right conditions can perform just about as fast as any C++ code, but if your talking about python (as much as i love python) you can kiss any real performance goodbye.
: in the end, never will be a blanket programming language for every application. When designing your application, take a look at what your domain is and from there find out which language best fits your needs. It really is as simple as that.
Yeah. I used google spreadsheets. Very complete. And very slow. I'll stick to KSpread, thank you.
110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
I'm going to have to agree with you there.
I can, for example, do some amazing things with little more than Javascript and a little hunklet of CSS - but I wouldn't try to write encryption with it (I tried it a while ago, actually; creating a 128 bit key took a few MINUTES).
And to be honest, Javascript is not good for complex interfaces; Check out http://www.fordi.org/comics and see what I mean. That little expandy bar NEEDS at least 1.5GHz of power to be usable.
110100 1101000 1101000 1100110 0 1101111 1101000 1100011 1
There's another performance issue you're forgetting: Multiple runtimes.
.NET makes Windows development not suck. Even Javascript will be useful as a desktop language come KDE 4. And all will run on reasonably modern hardware rather well.
.NET runtime, and a Python runtime, and Mozilla's XUL runtime all sitting in memory at once, each running one or two programs. That "reasonably modern" computer if yours is now not quite so spiffy, is it?
.NET". Sun's is "just do it all in Java". The open source world is largely ignoring the question entirely. :-)
Sure, well-written Java with the right non-Swing toolkit can be quite nice. Python can do wonderful things. PHP runs mission-critical aviation systems that get zillions of hits.
Now try running all of them at once.
Now you have the Java runtime, and the
Of course, MS's answer is "well just do it all in
That said, I do believe that "managed language" programs are the future. There are entire classes of bug and security hole that simply cannot exist in a language where you aren't futzing with memory directly (C/C++). I don't believe it's even possible to write a buffer overflow in Python or PHP (not sure about the others). The runtime, yes, but that's written once. You pay a cost for that, but in the long run it is a worthwhile cost.
Qt is about the only non-managed system I'd want to even think about coding for on the desktop or server. Handhelds and embedded systems, though, are an entirely different animal.
--GrouchoMarx
Card-carrying member of the EFF, FSF, and ACLU. Are you?
As other posters have noted, many large applications can now be written in a combination of native and interpreted code. Web apps are a classic example, but in our neurophysiology lab, we're just completing a new data acquisition system that does real-time data acquisition from several types of A/D converters at up to 20kHz, writing all data to an SQLite database. The system is written on OS X and the combination of Objective-C and Python with PyObjC has let us pick at will between native and interpreted code. The real-time loop at the core of the system is written in C, the more stable parts of the system are written in Objective-C (along with the Cocoa framework, the most productive language/framework combo I've ever used for desktop apps) and the more quickly changing aspects of the system are written in Python and wrapped as OS X bundles by py2app. Our users are physiology researchers and they can now write code in python to customize the operation, including stimulus generation and experimental protocol; they don't need to ever touch native code. Development was a breeze and the users' productivity in changing the setup between experiments has increased as well.
Adding to the mix, most of our users do their data analysis in Matlab (another interpreted language). We've written a set of Matlab MEX files (loadable libraries that allow native code to be called from within the Matlab environment) with a similar scheme (a mix of Objective-C and PyObjC) to allow users to retrieve data from the SQLite database.
So the original poster's question could more accurately be summed up as, what ratio of native versus interpreted code is best for your application? The next question is not whether native or interpreted code is coming or going, but what each is going to do to make integratino of the two easier.
The irony of the tagsoup is delicious...
No, stupid programming maybe... yes.
"All you have to do is be fragile and grateful. So stay the underdog." Chuck Palahniuk, Choke
Except that "South America" != "America".
I'd think that computer people could understand the difference. The 'South' in 'South America' is part of the string, it's not a prepended descriptive modifier.
"South America" is not a region of a larger area known as "America." "South America" is the name of a particular region (actually, an entire continent), period. (In the same way that "South Dakota" is the name of a place, and not just a southern region of some place called "Dakota.") Occasionally we confuse the issue by calling North America, Central America and South America collectively "The Americas", but there you have to be aware of the plural 's'. "The Americas" means 'multiple Americas.' If the area being dicussed was actually 'America,' then there'd be no need for the plural.
So to sum up:
"North America" is a continent, and includes the regions claimed by the United States of America, Canada, and Mexico.
"South America" is a different continent entirely,
"Central America" is a distinct geographic region between North America and South America, although it's considered to be part of the continent of North America.
"The Americas" is a term used to refer to North America, Central America, and South America collectively,
"America" is a shortened or common term for 'The United States of America,' a country located in North America.
The common uses of the words really have no conflict; it's all pretty clear to me.
"Ladies and gentlemen, my killbot features Lotus Notes and a machine gun. It is the finest available."
In other words, you're likely to be forbidden to distribute compiled binaries at all. A lot of programs that hobbyists would compile are under GNU GPL or another license that forbids adding restrictions against commercial fields of endeavor.
Linux only. So I can either spend $400 on the Windows compiler or spend $400 on purchasing Linux-compatible hardware to replace my Linux-incompatible hardware. And I still can't compile the Linux kernel and distribute the resulting binary because the non-commercial license is incompatible with the GPL. Hmm...
If your program is I/O-bound, interpreted is probably fine. If your program is CPU-bound, then the question is whether it's in system libraries (video decompression, number crunching) or in your code (specialized algorithm). Only in the latter case will the performance be affected by an interpreted language. As modern operating systems provide more and more specialized services, the need for compiled user code is diminishing.
I'm old enough to remember when all "serious" programs were written in assembly, and compiled code were looked down upon as "too slow" or "only for wimply programmers."
I would gladly invite you to demonstrate how a compiler is smarter than a human.
A compiler is a piece of software that's meant to translate from a human-readable language to machine language (be it raw machine language or assembly), in a reasonable amount of time, giving reasonable amount of performance.
There are lots of tricks to optimize the code and what not, but it is still an algorithm that often cannot surpass the ingenuity of a human.
A compiler will not necessarily maximize performance; it's merely meant to give you the best performance without forcing the programmer to write the majority of it in assembly. And a compiler isn't something you can write trivially, and despite gcc's faults, it's pretty damn good.
When you set certain flags targeting a certain CPU, it doesn't necessarily mean that it would make the compiler to be smart enough to use all the SIMD extensions available to do what is needed.
And I've got to laugh at all the notions that interpreted languages are approaching native code. BitTorrent uses Python, and running 5 torrents somehow initiates 5 instances of the Python interpreter, each eating up some 35MB of RAM. It forced the CPU usage to go high enough that my CPU cannot sit at a mostly idle 1.29GHz. Java is not that much better. Azureus dealing with 5 torrents eats up 90MB of RAM in total, but luckily it didn't eat up enough CPU to force power management to raise the clock speed.
I would gladly use a C/C+++ GUI torrent client anyday.
What language do you code the interpreter in?
-- Alastair
Let's consider a modern implementation of Common Lisp. It has an interpreter and a native code compiler. (To be fair, many have only compilers, and a few only have (bytecode) interpreters, but in all cases interpreter-like and compiler-like interfaces are exposed). The native code compiler can be run ahead of time, or when the program loads. Common Lisp supports all three models of compilation. Usually, you use whichever is most appropriate for the task at hand. When you're debugging, you interpret the code, because it gives better diagnostics. When you deploy, you compile the code, to get good performance. Theoretically, if you could run, e.g., a "Lisp applet" in your browser, you might use JIT compilation. Incidentially, this compilation-model-agnostic nature doesn't have to be exclusive to Lisp implementations. All three models can be applied to any programming language, and a programming language implementation could theoretically support all of them. The advantage to doing so would be that you would get the advantages of all of them: easier debugging with interpreted code, greater speed with compiled code, and greater portability with JIT-compiled code.
Thing is, the closer to the iron you program, the faster your system's going to be. Going from Java to C makes a noticable speed difference on every system I've ever tried it on. That speed difference will mean an advantage in an increasingly competitive market, and because of that companies will still try to do things in C (Or even assembly language.)
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
Your comment violated the "postercomment" compression filter. Try less whitespace and/or less repetition. Comment aborted.
;
...");
...";
... you have the source, trivial as it is :-) Native code is faster, as you would expect.
--- In other words, the lousy formatting of the source that follows is not my fault
To get a real comparison, just try running these two programs:
#include <stdio.h>
int main(int argc, char* argv[], char* env[]) {
int a, b, c, d, e, f, total;
total = 0;
printf("Content-type: text/html\r\n\r\n");
printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">")
printf("<html><head><title>c cgi test</title></head>");
printf("<body>");
printf("counting
for(a=1; a<=44; a++)
for (b=a+1; b<=45; b++)
for (c=b+1; c<=46; c++)
for (d=c+1; d<=47; d++)
for (e=d+1; e<=48; e++)
for (f=e+1; f<=49; f++)
total++;
printf("%d", total);
return 0;
}
and
<?php
print "counting
for($a=1; $a<=44; $a++)
for ($b=$a+1; $b<=45; $b++)
for ($c=$b+1; $c<=46; $c++)
for ($d=$c+1; $d<=47; $d++)
for ($e=$d+1; $e<=48; $e++)
for ($f=$e+1; $f<=49; $f++)
$total++;
print $total;
?>
You know< the c one is going to be more than an order of magnitude faster. (and if you didn't, I just tested them, but don't take my word for it
In which frigging paralell universe are you living please? I want to go there. C being orders of magnitude faster than interpreted languages I agree with, but C easier to debug? Either you've never tried interpreted languages (say Python or C#, PHP is not a language) or you never got past "hello world" (hell, even hello world is harder to debug in C).
In a word, you want D.
Or another nice high-level compiled language. Most of them are functional though (Haskell, *ML) so you may have some trouble adapting. And they usually don't allow variable-length strings, being functional and all.
"The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
Sure. It comes down to "how much of your interpreter can live in the cache?"
If your interpreter is getting cache misses on its code for every interpreted instruction, you can kiss performance goodbye.
-- Alastair
iTunes is dog-slow on every computer I tried it (compared to say Foobar or Winamp 2.95) and Winamp... well... Winamp3, do I need to say more?
Native code doesn't mean it's fast, it just means it's potentially faster than interpreted.
"The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
And this is a good thing, because it means more independance from certain CPU architectures.
And in other news, a mysterious link is discovered between bad spelling ("loosing", "independance") and advocating interpreted languages.
Acutally could there be something here? After all, writing native code does demand a greater attention to detail than the quick-and-dirty way...
That why eye always use May spill checker. There art know spilling miss takes in this post. And ewe forget to capital eyes Nazis.
All misspellings and grammatical errors in the above post are intentional and part of my artistic expression.
C as in Torrent?
"The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
Deary me, and there I thought that Ada had been used for real-time and embedded systems and that it was somehow "managed", having fancy stuff like buffer-overflow, off-by-one errors or array access errors protections (at compile and run times) built-in, and automatic dynamic memory management... deary deary me.
"The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
I kind of wondered at the debugging comment too.
I've found that java tends to be a lot easier to debug than c. By the same token, C was easier to debug than ASM in the class I had to use that for and one hell of a lot easier to track down bugs in than Flex and Bison when I took the language creation class my senior year (good grief that was a nightmare).
Everything I need to know I learned by killing smart people and eating their brains.
For quickly turning multi megabyte data sets A into multi megabyte data sets B, you just can't beat writing one script and running it on all the different architectures at my disposal with no compiling. Just run the damn script. I have libraries of various Perl modules for doing different things and I can run them from anywhere.
I know Perl isn't as fast as our compiled Fortran codes, but for the ease of use to do post processing, you just can't beat the flexiblity.
Mel would certainly not care for interpereted languages.
Most likely GStreamer. Quod Libet uses it, XMMS doesn't. This is something that has supposedly been fixed in a recent version of GStreamer. I know I get the same thing in Rhythmbox, which is written in C, and this issue is specifically listed in the release notes.
<xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
This question was boring 20 years ago. The short answer is to use a compiled binary where appropriate and use an interpreted language where appropriate. The difficult part is knowing when to use one vs. the other and in some cases it is not a black-or-white choice.
Of course, monolinguists will insist on writing everything in their language of choice because they don't want to learn any other language or the other language is "too hard" (or worse, isn't supported in their IDE of choice). The sad statement is that if this attitude persists, there will be nobody to write the VMs or JITs for the "non-native" languages.....
Of course, your mileage may vary.....
There's no ANSI-standard JAVA, or ISO Java; so you're not really sure what language you are writing in, whether it will mean the same thing in a year's time. Or whether there are defects in the interpreter (of course there are). Also, it's less environmentally friendly; in these 'carbon-conscious' days you would do well to remember that it will take more electricity to run an interpreted program ...
The problem isn't native-code vs interpretive code. It's that our native code languages are terribly flawed.
Programming backed itself into a corner with C and C++. They're useful languages, but they're not safe. Now this has nothing to do with performance; you can have safety in a hard-compiled language. Ada, the Modula family, and the Pascal/Delphi family did it. The problem is that, because of some bad design decisions in C (the equivalence of arrays and pointers being the big one), you have to lie to the language to get anything done. This makes safety hopeless. The basic problem of C is that you have to obsess on "who owns what" for memory allocation purposes, and the language gives you no help with this. The language doesn't even adequately address "how big is this". With those two design defects, we're doomed to have memory safety problems. Which we do.
C++ at first seemed like an improvement, but as it turned out, C++ adds hiding to C without improving safety. Note that this seems to be unique to C++; no prior language did that, and no language since has taken that route. Attempts have been made to work around the problem within the structure of C++, but with limited success. The "auto_ptr" debacle and the endless problems of trying to make sound reference-counted allocation work reliably indicate the fundamental limitations of the language. You just can't fix those problems in C++ without breaking backwards compatibility. (See my postings in comp.std.c++ over the last decade for more details on this.)
Java was invented mostly to get around the memory safety problems of C and C++. The fact that Java is usually semi-interpretive has nothing to do with the language design; that's a consequence of Sun's original focus on applets. There are native-code compilers for Java; GCC contains one. There are competitive advantages of locking the user into a giant environment (J2EE in the Java world, .NET in the Microsoft world), which is part of why we're seeing so much of that. But it's not a language design issue.
Microsoft came up with C# as their answer to Java, and most of the same issues as with Java apply.
What's so embarassing about all this is that it's quite fixable. The solutions were known twenty years ago. If you have a language where the language knows how big everything is, and the subscript checks are hoisted out of loops at compile time, you get safety with high performance. There were Pascal compilers that got this right in the 1980s.
On the allocation front, you can use either garbage collection or reference counting to automate that process. Java and C# are garbage-collected; Perl and Python are reference-counted, and in practice, programmers in those languages seldom have to think about memory allocation issues. Allocation overhead can also be hoisted out of loops. Java compilers are starting to do this, allocating temporary variables on the stack. Reference count updates can be optimized similarly. There's nothing to prevent using these techniques in a native-code compiler.
And that's how we got to where we are today, with buffer overflows, zombies, and blue screens of death, papered over with a layer of inefficient interpreters. Fortunately the hardware people have held up their end and made it possible to live with this, but we on the software side should have the understanding and grace to be embarassed by it.
What is cheaper now, a 2gb RAM stick or 100 hours of good low-level programmer time?
A lot of folks use languages like PDL, IDL, MatLab, Octave, or even NumPy to do array processing, and tout the fact that for large arrays those languages run "essentially as fast as C". But that's bullshit. All those languages vectorize their operations in exactly the wrong order - if you have a hundred million datapoints and you want to do six operations on each one, each of those vectorized languages will dutifully swap each of your hundred million datapoints out of RAM into the processor, multiply it by seven (or whatever), and push it back out to RAM before pulling them all back in to add six to each one. What you really want is to vectorize in pipeline order, doing all the operations you plan to on each data point once and for all so that you can take advantage of your processor's nice, fast cache. Nobody has (to my knowledge) figured out a way to do that, that is robust enough for an interactive/JIT language, so just writing it in "C" and getting the loops nested in the right order can speed you up by a factor of more than 10 on a modern AMD or Intel CPU.
I think the original poster meant that it's easier to debug the entire behavior of a C program than a Java program, which which I agree.
In Java, some of the behavior -- indeed, a lot of the underlying behavior -- when it comes to fine-tuning for performance, or 'why does this thing eat 400 megs of RAM?!' is hidden from the user; it's part of the underlying interpreter, and beyond the view of the debugger. In C, I can track my memory allocations and performance much more readily in a debugger than I can in Java.
I suppose I would've phrased it more that debugging a simple process is easier in Java or other interpreted languages, but debugging to performance-tweak is way, way easier in compiled languages than interpreted ones.
--Rachel
While for developers code may count it doesn't for users. If native code dies is only a questions if developers are able to build easily native code as if none-native code. As long as there are useful tools around. An these days this can be safely answered with yes.
On the other side users care at lot for native GUIs. As long as users are able to distinct e.g. a Java application from a binary (native code) application within 5 min. of using, vendors selling SW have to care for native code which produces far better native GUIs than none-native code.
Yet the SW industry does not work as in other branches. Since development costs is the driving force other considerations have to be taken into account. So for inhouse development, where users complains don't matter that much, none-native Java is favored and forced. On the other side in the free world and the commercial vendors there's no alternative to native GUIs therefore native code.
Yet the future of native versus not native isn't decided so far. With the hyped AJAX there's a none-native technique on the rise while with wxWidgets/wyoGuide (http://wyoguide.sf.net/) there's a now superb cross-platform native technique available. So it might be that in the end there's a draw between native and none-native going along very well.
O. Wyss
See http://wyoguide.sf.net/papers/Cross-platform.html
For most general purpose programming, sure interpretive languages will get better. The CLR's role will need to expand to encompass that of a compiler and an installer. IL's need to be capable of resource awareness, in addition to maintaining platform independence. Development environments would still build IL assemblies, but the first task of the average runtime library would be to polish up the IL in the native context of the target system (OS, processor, bus, etc.), then persist that output.
Parallelism might take some heavy retraining for those not used to it, but even this can be eased along by constructs like method attributes and compiler hints.
Except in extreme instances, the really hard work of multi-core enabling executable code will be put in by the IL, compiler and CLR designers, not by the average keyboard jockey. I'd also imagine that as these things continue to evolve, the problem of managing an expanding array of entry points into hardware resources will be handled by some of those additional hardware resources themselves.
Pi Ran Out
iTunes slow? Use Amarok, Quod Libet, or Banshee for a while then tell me iTunes is slower. iTunes is faster in bloody WINE than those apps.
You're right, I wouldn't steal a car. But if it were possible, I sure as hell would download one!
Interesting point ... so I tried to rewrite the stuff to see how ada compares, but my gcc complains that it (gcc) is missing part of the required ada functionality - time to download and update. I will check it out.
btw, you can get the same features for c++ (buffer overflow, outside-of-range access, automatically allocate, deallocate memory, etc) - either by building the appropriate objects yourself, or by using a library that has those features. Or, if you figure you don't need it, don;t use it. Just as you can turn it off in ada.
Try doing that with Java, python, etc ... You can't. The runtime environment is part of the language's definition. In that sense, ada isn't a managed language ... while the checks, etc., are part of the spec, from what I can see they're not essential and you can run more or less "unmanaged".
Sorry, I'm under Windows so I probably don't have Amaroq (maybe Quod or Banshee?). Anyway I was comparing iTunes to Foobar (which would be XMMS) and Winamp. Foobar is orders of magnitude more responsive than iTunes, Winamp5 with modern skins is also much faster, and I'm of course not even talking about Winamp2.
"The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
Why is it that as soon as processors get more powerful, memory becomes cheaper and hard disks get bigger, the next operating systems and applications suddenly need a lot more of it; but still present you with essentially the exact same thing?
Programs written in interpreted languages need higher systems specs to run at the speeds we are used to. Sure, the modern systems can handle it no problem; but shouldn't faster computers mean faster programs and response times? Instead we get the same or only slightly faster results because we program them in slower ways because it's easier and faster for us to do it that way. Maybe we're all just getting lazy.
And with operating systems, I mean Vista in particular: by the system requirements you can tell it's a resource hog. I was horrified by the system requirements of XP when it was released, and after I upgraded and started using it I asked myself: 'What was the big deal? How is this better than 2000 besides a shinier interface?' What about Vista requires the system specs it asks for? The even shinier interface?
No more Java geeks who think that people actually want to use Java applications. Speaking as a Mac/Linux user, I can say that having portability is simply not worth the bloat and hideousness of a Java application. I'll hold out for native apps in GTK/Qt or Cocoa, thanks. And I know that Windows users are not exactly hurting for native applications. So what the hell is the point? The only people who seem to actually like using Java applications are Java developers. The problem is that you lose so much OS integration by building a one-size-fits-all application.
-matthew
"THERE IS NO JUSTICE, THERE IS ONLY ME." -Death
Official "Vista Capable" Requirements:
800 MHz CPU, 512 MB RAM, DirectX 9 graphics card w/ 32 MB RAM, 15 GB free space.
Official "Vista Premium Ready" Requirements:
1 GHz CPU, 1 GB RAM, DirectX 9 card with Pixel Shader 2.0 and WDDM support, 15 GB free space.
I think either the author or Microsoft is out of touch with reality a bit, but I've running Vista with 1 GB RAM better than expected, and that tend to matter much more than the CPU speed from my experiences.
Beware: In C++, your friends can see your privates!
That little expandy bar NEEDS at least 1.5GHz of power to be usable.
P-III 600MHz mobile here and the thing works just fine. Sure, the images are a bit jaggy, but it's usable. Sure the CPU runs at 100% when I use the thing, but it's not the end of the world. I think that a 1GHz proc would cope without "jaggyness", but I have none around to test.
Ahhh...the great dumpster continuum. Many a free computer will be found there. -- sowth (748135)
Good point. My impression is none of the modern "interpreted" languages are compiled every time. Most are hybrids with bytecode and features like cached executables.
I'm sorry if I haven't offended anyone
Ain't it funny, that if you want to use interpreted language, you definitely want to have the Virtual Machine or Interpreted written in native, to save as much on CPU as possible?
Ain't it the final bottomline of using interpreted code -- interpreter itself being native?
Doesn't it mean that the supporters of interpreted want, and rely on the native stuff teh most?
One guess where 99% of the ccycles arae in that
I'll take a guess! And it's even the one you want me to guess. The db2 instance. That's the fucking *point*. The fast C code that's executing has already been written.. some of it is in the python interpreter, some it is in the ksh and php interpreters, most of it is in the db2 interpreter. Very fast algorithms doing what they do best: optimized, super fast loops operating on static types.
That is WHY python and other interpreted languages achieve the speed they achieve.. because what they do is allow you to glue together C code written by other people. And, because the Python code is much simpler, you can understand the interactions between the fast code more easily, and see where your code fails to perform well. It's always because you're putting loops together inefficiently and making poor design choices, not because of the speed of the interpreter--and now that your code is short enough for you to see that, you can fix it.
Your application logic doesn't need to be super fast. It needs to be super agile, so you can refactor and accommodate changing requirements and make smart decisions about which pieces you are going to use and how you are going to use them together.
C won't die, at least, not for a long, long time*, and that doesn't bother me, a hardcore Python programmer, in the least. Somebody has to do the dirty job of writing those fast loops. Meanwhile I'll be here zipping through the application implementation.
*It will eventually be replaced by Pyrex, of course.
It's rare that you're presented with a knob whose only two positions are Make History and Flee Your Glorious Destiny.
Yeah, I know some folks do server-side Java, but I wasn't talking about Java. My debugging comment was comparing C to scripting languages like Perl and PHP. They've gotten better, but I still find myself missing gcc regularly....
I don't have much of an opinion on server-side Java either way.
Check out my sci-fi/humor trilogy at PatriotsBooks.
I'm currently working with a military simulation network. That means that speed is of the essence, and memory is tight. We already are using 3GB and more of RAM, and we could expand to use any that we are theoretically given. If there's memory overhead from the interpreted language, it's unacceptable. If there's a speed penalty from an interpreted language, it's unaccpetable. There are times when code is written that is nowhere in the realm of good coding because, yes, function calls do take time because not everything can be inlined. There are others working on the same project using interpreted languages, but they're not able to work at the resolution that we work at. To mirror some other comments, if you're writing GUIs, or database apps, or web apps, then interpreted languages may work just fine for you. I never intend to do those things as I think I'd be bored beyond belief. I write algorithms...and I use native code.
I think a lot of that ram is the incoming data waiting to be written to the cpu and outgoing data held in memory to be sent out to others...
But what do I know.
Also might just be java swing being bloated, I think azureus has a command line version, ive never tried it though....
ahem.. you obviously have not done java extensively, for client side apps you are set with a vm, thats it, everything else has to be bundled in the jar. For server side apps, a jee container does it in conjunction with a vm, everything else should be bundled in the ear or war file... seems hard? Programming java is a different issue, if the vm and jee server do not fullfill you needs you have to go jar shopping, which is not too bad, good ides bundle most of the stuff you need and basically a webapp is a push of a button.
There's a whole number of reasons why native languages are still in very heavy use in a number of environments and industries. The original post plays down the performance concerns but they are a real consideration for many products. Compare the user experience of a Java GUI application to a native C++ one of comparable functionality. Even if the C++ product uses MFC or somesuch it will still be faster, more responsive and leave more CPU and RAM around for the other apps. Embedded systems often don't have enough system resources to make an interpreter or vm workable at all. Some applications (i.e. games) are engineered specifically to use as much system resources as possible, in order to provide the best possible user experience. A vm might take 2ms per frame and 4MB of RAM (or quite a bit more in some cases) that's a pretty serious thing for a game, you might have to remove something (or several things) to free up enough resources for that, and it would add nothing to the user experience at all.
In my experience this is not really the case at all. Decent C compilers are available for almost every single platform in existence, most interpreters and vm's are compiled on C compilers. In contrast many vm's are confined to specific platforms, or have only patchy support for platforms other than PC.
Platform support aside I would also assert (without any actual proof) that the consistency between platform implementations for a given C++ complier is far in excess of the consistency between platform implementations for most vm's.
Also, vm languages often need extra (native) runtime modules to access specific API's which are not available through the language itself. This means that if a required runtime module is unavailable for a given target platform, the application developer is basically barred from it until it becomes available (or they write their own native module to access the API).
Finally, vm and interpreted languages almost always require more setup of their target environment(s) than native languages. Most of these kinds of languages have no concept of a linker, so all module binding is done dynamically (i.e. at runtime). Obviously some OS's (i.e. windows) lean towards dynamic bindings for native code as well, but native languages are equally capable of both. When you're writing any kind of consumer targeted software, telling people that they need to download the latest jvm (or whatever) and wait another 20 minutes (if you're lucky) for that to download and install just so that they can start to install your software is a sure way to send them to your competitors... If it doesn't then get them started on setting their CLASSPATH.
This is an arguable point at best. While such languages are often easier to both learn and to start new projects for (i.e. no build scripts etc.) I wouldn't say that there's a clear winner for overall development time. It often depends on what you're trying to write. Generally lots of string manipulation and calls to standard system modules (i.e. file system etc.) are simpler in interpreted languages (provided that you're not trying to keep your memory footprint down) but some other things are easier in native languages (i.e. encryption or math which requires specific and consistent accuracy).
Garbage collection is often cited as a feature of interpreted languages which decreases development time (because developers don't need to worry about memory allocations and deallocations) but garbage collection is also available in native languages, it's just not popular. Also, doing 'advanced' things in interpreted languages is often quite a bit more tricky than their native counterparts (i.e. function pointers - the C# equivalent is far more complex).
In general (l
Which is cheaper: spending hours trying to get a 64-bit Perl to work correctly or spending a relatively small amount of effort writing code that does its own memory allocation and deallocation?
Seriously. I have a number of things I do on an almost daily basis in Perl in which I have to do that run dangerously close to VM limitations in a 32-bit process. There are a number of things I would like to do to the technology in question where I run into a wall. This is not web stuff, mind you, but... there are reasons I like to be able to code things in straight C without a lot of outside dependencies....
I also did some rather fun code in PHP once that took ten or fifteen minutes to execute in PHP. I did a straight port of the same code to C and it executed in a fraction of a second. (It didn't work in either language, mind you, but at least it failed very quickly in C.) That's a very extreme case, but such things do happen, particularly when it comes to the gross inefficiency of doing things with associative arrays that would be more effectively written using plain arrays, structs, etc.
Besides, for me doing my own web sites, 100 hours of good low-level programmer time on evenings and weekends are essentially free. (I'd probably just watch TV otherwise.) A few gigs of RAM is actual money.
Check out my sci-fi/humor trilogy at PatriotsBooks.
You are right. And now try to shift your statement to higher level: replace C with Smalltalk/Java/PHP/... and Assembler with C/C++. Arguing about native languages vs. interpreted languages is like arguing about C vs. assembler.
Every language has its place. Problem usualy is not that a "language is bad", but the problem usualy is the lack of interfaces between languages. Nowdays, each higher level (higher than assembler) language has its own set of libraries, own concpets inside those libraries. Lack of glue leads developers to use one language only for whole project. Or perhaps it is not lack of glue, but lack of interest to use glue...
How it should be? Write fast routines in assembler, glue them with C and provide C libraries. Write application building blocks in C/C++, glue them with Java/Smalltalk/PHP to create applications...
First they ignore you, then they laugh at you, then they fight you, then you win.
$(SUBJ) is if software development would move from native code or P-Code or Java to something that does source compilation stage also in JIT (I am awed with what Psyco does, but I'm sure there are many other possible options). See - it's nice that OOo or Mozilla are open source but it's sure as hell that I don't have dedication to download source for it, dependencies and spend a day or two just trying to compile it. Now - if this software would be available in "runnable source" form then I think we will have 10x number of developers compared to now. As it stays - barrier to entry is too high.
I think at least Python in its _current_ form is suitable for writing an office suit or browser, not to mention "simpler" apps. And I don't see why other languages cannot achieve same level of efficiency.
I've been making a living contract coding C++ and Qt for about four years now. I've also used Java, PHP, python, and a couple of other languages for various projects. I really like Java as a language, I think PHP is pretty nice and useful and I absolutely adore python. But the C++/Qt combo is what I enjoy most.
.NET, where Mono only implements part of the environment.
.NET are almost non-existing. Why? Performance. These systems are based on slow processors and always too little memory. But with a little extra care, I can use the same C++/Qt combo to solve the projects here.
.NET application to Qt (this was one of the rare Windows only contracts) because the performance of the .NET app was so horrible it was going to be rejected by users. And the Microsoft engineers who helped this company solve the issues kept saying "the next version will fix all your problems". Well, after three new versions that didn't fix anything, they decided to get rid of .NET and hired my company to rewrite it in Qt. And they are incredibly happy with the result. The application outperforms the old .NET app in every single way. Even on large workstations. For this company, managed code is something they might look at again in some distant future.
I'm very much into cross platform - usually all my projects have to run on Linux and Windows. My experience from this tells me it's not more difficult to do in C++/Qt than it is in Java, but you need to know what to avoid. The Java saying "write once, compile anywhere" is marketing bs. Java apps needs porting, just like anything else. It's even worse for
I also work a lot in embedded devices, and in this area the Java and
Another case where performance mattered: I got a contract to port a
The one thing that can get more complicated with native code is deployment. The Java way of packing everything in a single jar file often works really well. With native code you have to care about library versions, binary compatibility, and different OS versions. This is a real problem, that managed code has much better answers to.
My experience is that it is not more difficult to write code in native C++/Qt than in Java. The outcome of it is more difficult to install and deploy, but after it is solved, you will get an application that has a better look'n'feel to it.
Bo Thorsen,
Thorsen Consulting.
As for web apps, hardly anyone uses native code to render HTML but a lot of what goes on behind the scenes such as database drivers, interpreters, zip libraries etc are native (if they work at all). The browser too is native.
So there is really no 'end' for native code.
You see this? This is a C style comment. We're not going away any time soon my friend.
*/
Why? Because Python makes it easy to use the right data structures for the job. It is trivial to use hash tables, trees, and all that in Python. Not only are such data structures easy to use (a = {} is all it takes to create a hash table), but crucially, they are easy to print, and easy to input on the command line, making debugging a breeze. Yes, C++ has STL, but you cannot match the easyness of creating and printing data structures on the fly in Python (I assume Ruby, etc, are similar).
Thus, in Python I tend to think carefully which is the best data structure and algorithm for the job. In C, I tend instead to be lazy, and use the data structures that are easy to use (what's that, arrays?). As a result, on small data sets, my C code is typically 4-5 times faster than my Python code, but on large datasets, I often get O(n log n) algorithms in Python where my lazyness in C yields O(n^2), and this shows.
As a result, I am now a convert to Python (and I want to try Ruby). The programs I write are faster when it matters, easier to write, no memory leaks, no segmentation faults, no memory management, no worries... there is NO way back.
1990 actually. vs 1987 for PERL, 1990 for Python, 1995 for PHP, and 1995 for Ruby.
You can't see ANYTHING from a car, You've got to get out of the goddamned contraption and walk...Edward Abbey
The only downside is that a great number of slashdotters would suddenly have an unmanageable amount of free time.
I think the parent has this almost completely backwards.
As the complexity of enviornments increases (many cores, multi-chip packages etc) it's going to be harder to compile a program to binary that can take advantage of the resources on all the systems it will run upon. It may work really well on one configuration, and may run on many, but it won't make the most of the resources in many cases.
VMs have access to information about the runtime environment and can dynamically compile byte codes to binary to take the best advantage of the available resources - some can even re-compile on the fly to tighten up performance based on feedback from the environment. From a developers POV a program can run on many platforms, and can run as well on all of them.
I have implemented GUI apps in C++, C#, Java, Matlab, and VB. I am seriously looking at Java/Swing
/Swing. The close similarity allover makes the differences in developer convenience positively glaring. Yes, a lot of it is just syntactic sugar to you language people, but boy do you get tired of writing it the long way when you know how much easier it could have been. The GUI APIs show a similar trend, Swing making you do all sorts of unneccesary stuff before you can get to the point.
I'f you've wokred wit GUIs in C#, I can tell you right now that you will be very frustrated with Java
sudo ergo sum
There, fixed some typos for ya.
"An average apple tree nowadays holds enough fruit to fill several baskets, weaved in your local apple-centric basket-weavery, which are carried by human power, or simply loaded onto a truck. Particular to Golden Delicious afficionados, the announcement of new apple tree fertilizer means that future apple trees will laugh at the nominal apple load requirements of current baskets (e.g. hearth baskets, berry baskets, ribbed baskets, and gourds). Regardless of the negligible vitamin C per pound hit compared to oranges, major fruit farms, as well as a lot of freelance fruitpickers, prefer oranges for major baking projects even though apples are easier to bake a pie with, often have a shorter development time, and are just as powerful as citrus. What does the Slashdot community think of the current state of apples versus oranges? Is it time to jump in the boat of apples? Do pastry chefs feel that they are losing - an arguably needed - dose of vitamin C when they eat apples? What would we be losing besides lemon merengue?"
Ai feer it wud saund mö laik ei mix bitwiin e swiidis ef and ekoslovääkiun...
America should have been called "Columbia" afterall. :-P
Seriously, for me, a spanish guy, "America" may mean "North America" + "South America" or USA depending on the context. This sometimes may lead to confusion...
And of course Slashdot just HAD to not support Unicode...
Yes, a lot of it is just syntactic sugar to you language people,
Syntactic sugar is a phrase devised by programming language types to justify incompetent HCI design in their pet language. E.g. programmer: "but your choice of using ancient hungarian for keywords makes the language difficult to use in practice". PL-type response: "ah that is just syntactic sugar".
Syntactic sugar is like syrup for pancakes: judicious amounts make them infinetely more palatable, but it does not mean that the more syrup the better.
After using the "P" languages over the years (Perl, Python, PHP), I still find c to be my favourite (probably because I really like the preprocessor).
You do know that you can use the C preprocessor on any text file, right? It's a standalone program on systems using GCC. You will have to avoid shell-style comments (#), but otherwise it works well. It is a bit weird running Make on your PHP files, though.
echo -e '#define MSG "hello"\necho MSG;\n' | cpp > processed.php
I'm not sure that we've moved that much. I think Gosling and the other originators of Java are still pushing in the wrong direction with GUI; see his remarks on Eclipse / SWT.
It is not a Java problem per se, but goes right back to the issue of creating cross-platform client apps in the first place. Many of us like to think of the OS as something that provides services - disk access, windowing, etc - that look like they can easily be abstracted - and they can. However, as well as being OS, Windows, OS X, KDE and GNOME are platforms - a set of programming APIs and a philosophy.
Rather than transcending these differences, Swing is yet another variation. Potentially you could make a Swing app that did look and behave identical to a Windows app - but it would feel plain wrong on OS X. The reverse is equally true (well, just about - I don't think you can use the top-of-screen menu bar in Swing apps).
I think SWT may be the better approach - it's not write-once run-anywhere, but you are reducing the amount you need to port. And as said above, you need to consider the philosophical differences between platform HCI anyway.
Ironically one of the few really successful Java GUI apps I know is a data visualisation tool - it mostly consists of OpenGL calls so it's a bit of a misnomer to say it's Java, but it's back to the point that it's the APIs that count. OpenGL is a nice x-platform API.
'Capitalists of the world, unite! Oh
That's
Java and C# are garbage, collected;
I have to agree, on Windows alone I find the VMs work differently depending on which version of the OS is being used. Of course in the early days of Java, MS did their best to fuck Sun's chances by releasing their own VM that was hopelessly broken and worked very differently from Sun's versions.
.Net being byte-code instead of compiled either, there is no need for cross platform support because MS don't want to support other platforms. Why they actually let Mono keep going I don't know, you'd have thought they'd shut it down as it's .Net without paying for it.
I don't see the point in
There are many dialects and accents of english spoken in britain and
in just england itself so you can't say there is such a thing as
"british english". However , given the language is called "english" I think
its fair to say that whatever dialects and accents are spoken in england
can safely be called "english" and any spoken in other countries called
english.
After all, you don't say "french french" when you speak about the french
spoken in france , though you will say "canadian french".
What is cheaper now, a 2gb RAM stick or 100 hours of good low-level programmer time?
100 hours of work payed for or shared among many users will be a lot cheaper then all those people buying more memory.
I think a lot of that ram is the incoming data waiting to be written to the cpu and outgoing data held in memory to be sent out to others...
Written to the cpu?
But what do I know.
Indeed.
My point: use the right tool for the right job. C++/Native is good for large-scale computations involving floating-point calculations over large arrays of data. C#/Java are faster on data structures manipulation programs like formula translation algorithms, etc.
Here are my two challenges for everyone.
1) The challenge for those who claim C#/J#/Java is faster than C++
Rewrite my Win32 Tetris with software background animation in a JIT language and make it faster than the C++ implementation. (BTW, the initial version was written in Java/SWT, then Java/AWT till it finally got ported to C++/Win32).
2) The challenge for those who claim C++ is faster than C#/J#/Java
Rewrite my SQEMA (a modal logic algorithm) implementation in C++ and make it faster than the Java implementation.
Here are the sources of the above-mentioned applications:
http://myjavaserver.com/~dimitertg
Side note: Don't mind the intimidating license of SQEMA. I will change it to something nice when I get to 1.0 (that should be next week since it must be completed by then).
I have tried both challenges and failed miserably.
As for the prize for those who complete the challenge - well, nothing, except the pride you may take in what you have achieved.
GCC is optimized for portability, not for performance.
Some performance optimizations that are included in other compilers are not in GCC if they would break GCC code portability.
Keep that in mind when benchmarking GCC.
I think there'll always be a need for native code, as there are some things you simply cannot do with interpreted/JIT languages. For instance, I'm working on a WIN32 application in C++ which performs a low level analysis of a hard disk drive and displays the results in a dialog box. Whatever about Swing, the low-level stuff is nigh on impossible in most interpeted languages. You also have to remember that most of these languages provide a high level of abstraction over the actually hardware your programming, so it's impossible to gain an understanding of what your program is doing in memory and in CPU registers when EVERYTHING is shrouded in namespaces and classes provided by the language vendor. One option is to use a native interface like the JNI, but I used that when developing my disk application for Unix and it was fairly horrible.
Please allow me to jump into all this Java discussion. In my opinion Java is becomming more and more cluthered and obese. Every new version they put in a lot of new functions but also want complete backwards compatibility. Another major problem is those JVM's that are drifting away from eachother, some applications need their own special JVM.
In the +/- 16 years of development you can't just keep adding stuff, it just becomes to big/large. The concept is (imho) very good, and they are moving in the right direction. The thing we need is a major company (like Sun) that takes the risk of dropping all backwards compatibility and make a whole new version with good straight forward rules and syntax.
When that happens, with a good VM and JIT, people will start using it..
My blog: http://www.redcode.nl
why do i force users to download 30MB .net framework to run 300KB IE toolbar?
thats NOT written in native code.
.net are certainly taking vbs share of the desktop market (primerally internal apps that users are forced to use) as well as a large chunk of the server side but they don't seem to be touching the major commerctial apps!
java and
note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
The line between interpreted and compiled, however, is blurring. Languages that are traditionally compiled can sometimes now be interpreted, and vice versa. There exists both a C interpreter and a Lisp compiler, for example. One could write a performance-hungry program in, say, Perl, run it normally (using a Perl interpreter) for testing, and compile it when it's ready for use.
Also, interpreted and compiled languages can play nicely together if you let them. Guile Scheme, for example, can be embedded in a C program. There also exists a feature of Perl that allows the use of C libraries from Perl code. There is nothing stopping one from writing the core of a program in C and allowing extensions/plugins to be written in Scheme; in fact, several programs (i'm looking at you, GIMP) take this approach.
Many excellent points by many posters about the "life" left in native code. Let me add my $0.02. We have a system that has a fundamentally non-parallel* execution profile where it is hard to determine the "full" scope of the objects that will be touched by a given transaction. We keep all our data in memory and so we are starting to care about the organisation of a data structures so that we can keep more and more of them on the L1/L2 cache to avoid having to go to memory to get records that we just looked at (its just too slow). From a singe processor (obviously a multi processor machine but one of them used to 100% by the system) we seem to be seing around 40K transactions per second.
With that as background, native code to us means that we are able to control, influence and ensure the code path that each transaction is executing and thus squeeze as much as possible out of the single transaction path that we are constrained to use. It also means that we can truly _find_ the sluggish parts of the most commonly executed code and make them X% faster thus making the system almost X% faster itself.
*Whether our problem is parallelisable or not is an interesting question but since it is like that the most popular objects will be involved in the vast majority of transactions then it is very hard to think of a way that paralleising the process will give us any real benefit since we woul have to handle the locking/deadlocking and race conditions for a fractional increase in performance, all of which is probably going to cost more than that fraction for all the other transactions as well.
"The first thing to do when you find yourself in a hole is stop digging."
An average PC nowadays holds enough power to run complex software programmed in an interpreted language (...)
2 15
Apparently, Intel does not agree with you:
http://www.behardware.com/news/lire/10-06-2006/#8
If even a relatively simple GUI of driver control panel is considered unsuitable for "non-native" technology, then it is understandable why more complex desktop applications are still far away from being routinely developed in such languages.
In my personal experience, I'm yet to see "non-native" application that does not feel sluggish compared to a similar native application.
It takes a couple of seconds for medium-complicated stuff to fire up on my P3-800 at work, but nowhere near as bad as Windows. Linux treats it the same as perl or python - just uses the java runtime to execute it.
My recent experiences with some rather well-coded Java stuff has even made me give up my native prejudice against it (formed in 1998-99, when it truly did suck). The GUIs went from hideous to okay...
Why can't I mod "-1 Idiot"?
The key here is the application you're writing - The vast majority of enterprise apps do more or less the same thing -
1) They put a form onto the screen
2) They wait for some user input
3) They perform a database search on the basis of that input
4) They perform some basic math (multiplying the unit price by 1.05 to add sales tax for example)
5) They put some data back into the database.
When you look at the app's behaviour, it's actually waiting for something most of the time - Waiting for the user to press a key, or for the database to return some result.
It doesn't matter how fast your code is - All apps "wait" at the same speed.
The scenario I've shown above may be generic - but it's what the majority of enterprise applications do. In this scenario it's very hard to justify writing the app in a 3GL or Assembler.
There are plenty of other scenarios, though, where no matter how fast processors are, or how cheap memory is, there is going to be an advantage in writing native code. Any very complex math, massively parallel task management, device drivers etc will, in general, be more suited to a lower level language. But even here, I think that exceptions can and will emerge - Domain specific higher-level languages will increasingly do a "better job" of creating fast code than we can.
In practice higher-level languages, scripting languages, 3gls and Assembler have co-existed for decades and will continue to do so. Better approaches to interfacing and re-use should actually make this even easier to do - So we'll use higher level tools and scripts to tie things together, paint UI's and do lots of groovy IO and presentation layer stuff, while invoking services that have been implemented using all sorts of lower-level techniques.
There's a cultural factor too... I've seen evidence of "language machismo" in my time... developers insisting that their hand crafted code will "always be better than that nasty generated stuff" - In my experience, while this is sometimes true, it isn't always the case. So perhaps we need to exercise a little more circumspection when we sit down to make our choices?
I agree with Animats that C++ si full of security holes - the lack of checks is what gives C++ the 'native speed'.
But after some years of dealing with C++ memory leaks, buffer overflows, smart pointers going dumb, incomprehensible templates,
code which compiles but does nothing (see below), you want change. More C++ rants here and here.
And now Bjarne Stroustrup wants to create another version C++09? That's just wrong.
My suggestion: Think about moving.
Move to Java via http://jazillian.com/trial.html,
or translate your code to C# on code2code.net.
Disclaimer: code2code is my web site.
PS. Example of code that compiles with GCC and microsoft's CL.EXE but never does what it seems to do -
It never calls fct2():
If I could find such a thing, I'd probably still write all my CGI programs in C instead of only writing the most performance-critical pieces in C. As it stands, it's enough of a pain to make C CGI code work correctly that it isn't worth the trouble for me, and so I suffer the performance hit (generally of PHP).
You make some good points, especially about fragility of C on server-side, but I think you are missing the main reason of why CGI in C (and CGI in general) is sub-optimal solution in most circumstances:
CGI does not provide state management.
Basically, you end-up with having to do all the initialization steps all over again for each HTTP request - you are unable to retain non-trivial state, such as database connection or COM reference, across the user session.
We had this particular problem with one of our recent project that exposed certain PTC Pro/INTRALINK (which is a kind of CAD version control system) functionality to the Web. First version of our application was CGI written in C++ that talks directly to Pro/INTRALINK API. We ended up having to reestablish Pro/INTRALINK connection each time user requests a new page. New solution, which is combination of ASP.NET and COM wrapper around Pro/INTRALINK API, is able to initialize COM object (which then connects to Pro/INTRALINK and does some other one-off tasks) at the start of the user session and then retain reference to this COM object until user session expires.
Speed-up is several orders of magnitude.
If performance of PHP is absolutely critical, you can use one of the Zend packages to pseudo-compile your code. From what I've seen there is a noticeable improvement on any script which does anything above 'light' work.
How many people can read hex if only you and dead people can read hex?
Ai feer it wud saund...exactly the same, just be spelt differently.
Actually, non-native speakers are usually much more careful about the spelling, since they were already able to write when they learned the language. Also, speaking personally, I've always been unable to learn (ie remember) a new word without figuring precisely in my head the way it was written. That said, "loose" is nothing compared to the "its/it's" and "they're/their/there" disasters... ciao S
The Kingdom of the Netherlands, comprising Netherlands, Netherlands Antilles, and Aruba is a federation established 1953.
OK, perhaps that is a *bit* pedantic. Even so, the Netherlands has been a parliamentary democracy since 1848. The US is still older.
-- *~()____) This message will self-destruct in 5 seconds...
Is there any truth to the rumor that Windows Vista had big chunks of managed code ripped out because of performance issues? If that's what happened, they certainly couldn't admit it...
- start here: Assembly eplaces many tasks formerly accomplished in hand-written machine code. But I can write much smaller programs by manually plugging/unplugging these-here vacuum tubes
- "macro-assembly" allows programmers to code for different cpu instruction-sets simultaneously. But, but... the hc11 has an extra 16-bit register than the 6809, I can shave 2 bytes off your macro-code, you lazy bastard!
- C replaces assembly in the majority of roles traditionally set aside for assembly. Your sacrificing all that speed to save time. (snickers at your times-two multiplication expressions)
- c++ blah blah c. blah blah syntax sugar blah blah
...
....
Wash rinse repeat. In 10 years the Java camp will mock the young 3DUML-on-rails punks that use tactile feedback gloves.The JIT compilers and virtual machines don't make it easier to port between platforms. .NET is difficult and time consuming.
Java code only runs on the java virtual machine, porting that to the python interpreter or
If you are refering to being able to run the code on different hardware platforms then software virtual machines make different hardware platforms pointless in creating because to the software they are all the same.
Portability is silly if it makes you unable to take advantage of any of the features of the platform you're developing for.
- Jesse McNelis
...and that is all I have to say about that.
http://jessta.id.au
In a nutshell, programmers and computer scientists are uncomfortable with the fact that there's actual HARDWARE in the system, and this somehow taints their pure, beautiful software designs. That is to say, they unconsciously can't stand that software has to run on hardware. So, they've invented "virtual machines" to abstract away the icky hardware with all of its yucky "engineering hacks". Of course this is justified with the old, battered strawman of "portability". But really it's all about not having to worry about registers, MMUs, memory addresses (physical and virtual), I/O ports, etc.
But if you forget that ultimately, software is nothing more than machine code being interpreted by a CPU, then you've lost a huge part of what computers are all about.
Joel Spolsky says it best (OK, it's dated, but substitute Java for Pascal, and it still applies):
The conspiracy is that the software industry has moved in a direction to accommodate people who don't understand pointers. To acknowledge pointers would be to admit that there's machine-addressable memory in the system, which would be to admit that there's hardware in the system.
And we can't have that, can we?
In the course of every project, it will become necessary to shoot the scientists and begin production.
Java apps are written by developers who only care about themselves, not their customers.
No sig today...
The European Commission has just announced an agreement
whereby English will be the official language of the EU rather than
German which was the other possibility. As part of the negotiations,
Her Majesty's Government conceded that English spelling had some
room for improvement and has accepted a 5 year phase-in plan that
would be known as "Euro-English".
In the first year, "s" will replace the soft "c". Sertainly, this will make the
sivil servants jump with joy. The hard "c" will be dropped in favour of
the"k". This should klear up konfusion and keyboards kan have 1 less
letter.
There will be growing publik enthusiasm in the sekond year, when the
troublesome "ph" will be replaced with "f". This will make words like
"fotograf" 20% shorter.
In the 3rd year, publik akseptanse of the new spelling kan be
ekspekted to reach the stage where more komplikated changes are
possible. Governments will enkorage the removal of double letters,
which have always ben a deterent to akurate speling. Also, al wil agre
that the horible mes of the silent "e"s in the language is disgraseful,
and they should go away.
By the fourth year, peopl wil be reseptiv to steps such as replasing "th"
with "z" and "w" with "v". During ze fifz year, ze unesesary "o" kan be
dropd from vords kontaining "ou" and similar changes vud of kors be
aplid to ozer kombinations of leters.
After zis fifz yer, ve vil hav a reli sensibl riten styl. Zer vil be no mor
trubl or difikultis and evrivun vil find it ezi to understand ech ozer. Ze
drem vil finali kum tru!
617B3B7F7E7C7D7F00EOF
I personally think that the cost in watts to execute an interpreted program is greater than a native binary. Shouldn't we be thinking about the electrical cost? Surely we should be burning coal/gas for more useful things rather than some glitzy program.
Why UNIX?
I have yet to be impressed by a Java application on the desktop. Everyone cites IntelliJ as a great example of Java on the desktop. It makes me cringe when it has to garbage collect occasionally, pausing for a couple of seconds. (GC may be faster than manual memory usage over the long term, but if it stops the user from getting anything done, it is slower in their eyes.) It consumes, on average, two hundred megabytes of RAM. The interface mimics a native application, getting it wrong in several places. Several common keyboard accelerators just do not work.
We need better native languages, thats all. D looks like it could step up here and fill that gap.
cd music
mplayer *
for it's speed...
To merely ask this question shows that you've never done serious amount of real work programming.
First of all every problem has a tool that's going to solve the problem best. Sometimes it'll be java, sometimes C, C++, python, ruby, php, etc, etc.
And second of all JIT compiled or virtualized languages often offer little benefits (in terms of what you've prescribed -- which is very little) over natively compiled languages. What I mean is... there's nothing inherently "better" about virtualized code. It's great in certain cases but that's it!
Did you even think about the question before asking it? Would you write a top-tier 3d game in java? How about an office suite in python?
The answer is no, and no. Not because java and python are bad (in fact they're great!), but rather because there's another tool that's better suited to the job.
Think before asking. It's a sad day when this makes it to the front page.
This is a fake dilemma.
6 151.aspx
Languages compiled into bytecode can be JIT-compiled into native code, or they can be pre-compiled into native code using a utility like Microsoft's NGEN. And when you are pre-compiling you have all the time in the world to optimize.
In a small but non-trivial program you can usually get C++ to beat Java and C# by throwing away all the high-level features and programming in what can be called "C with templates". But as soon as you start relying on, say, std::basic_string you may get surprised to see that C# and Java are winning. Java and C#'s GC-heap allocated strings are faster than C++'s basic_string if you use them in data structures because in Java and C# you only allocate the string once and pass it around by reference, where in C++ the each copy of basic_string is either going to allocate separate copies of its contents or do thread-safe reference counting which is unfriendly to the processor's cache.
I can also provide examples where real-world C++ will provide significantly better performance than Java or C#.
On a real-world program the performance of C# or Managed C++ is going to be roughly the same as the performance of C++, while depending on the problem Java may trail a little bit because it lacks structures so some data cannot be packed as tightly thus leading to more cache misses.
To see an example of C++ and C# being pitted against each other on a real-world problem take a look at the follow thread:
http://blogs.msdn.com/ricom/archive/2005/05/10/41
As I said, this is a fake dilemma. A more interesting question is how does the performance of mostly dynamically typed languages (Python, Ruby, Lisp) compare to the performance of statically typed languages (ML, Java, C#, C++)?
Peter Norvig has some numbers from four years ago:
http://www.norvig.com/Lisp-retro.html
On a real-world problem without external bottlenecks (database, network) dynamically typed languages can expect to be between two and five times slower than statically typed languages, though the trend is expected to worsen somewhat due to the expanding gap between the speed of the processor and main memory.
Also note that Lisp has by far the best performance among the dynamically typed languages. Companies that write Lisp compilers have been working on the problem far longer than the authors of Python and Ruby, and have significantly better type inference engines and compiler back-ends.
Dejan
>> I know what you mean. In Linux, I used tons of music apps like Banshee and Amarok for their features, but got >>up and went back to XMMS for its speed. JIT languages are NOT appropriate for every task.
Me too...but the news is at least Amarok is written in C++, and i find Amarok and Banshee comparable in speed.So...where are we? Native code is not necceasrily fast.
But Amarok is still a lot popular..there are speed/memory/CPU freak inside all of us..who want to run "free -m" or rather set that as PS1 itself..or do top or run some other CPU/memory monitor.
Basically, If we have 1GB ram and lets say FF and Amarok together takeup 300MB and we have some 400MB free...then there are freaks here...who would switch to XMMS, because they think...what the heck Amarok is taking sooo much of memory. Its psychological and have felt myself sometimes...are you gonna take that "free memory" to your death bed? You have a sufficient fast system with Suse10 but you get this constant "need" to compile Gentoo on your notebook, so as to save CPU cycles and memory. Few guys...who advocate native code here...are just speed freaks like this....they dont care how user friendly or useful a program is, but they are gonna dump it because it takes memory and curse the hell outta plugin engine/scripting engine supported by that app.
And somebody talked about gaming apps...agreed they will be written in Native languages mostly, but just write the AI logic for me in one of those big games in C. Will you? Ha...second life...runs almost >2000 script threads in their games.There is a place for everything..just dont curse interpreted languages yet.
I am not sure..how interpreted languages will scale once multi-core and cell architectures take over the world..i don't know basically.But can't we have runtimes written specifically for those architectures...and may be they will provide us new PARAMS to optimize the interpreted code.
And like M$ bashing, one of these days..everybody would dump some shit on ruby on rails.People would compare it with PHP..and what not.Somebody asked about a high load server and who is stupid enough to write it in interpreted languages? Well...we are working on a application server almost entirely written in ruby ( parts in C actually, which were not doable in ruby) and it works as charm.
I don't think it's true to describe Perl as an "interpreted language". Firstly because it's compiled, at run time before execution. Secondly, and more importantly, it's not a language. It's line noise.
The end is coming. If we complete our project - http://gotdotnet.com/Workspaces/Workspace.aspx?id= cc3191af-1b3c-425c-a21d-4729196ec37e
The idea is to produce mutable OS core with MSIL to x86 compiler build in it.
Join.
C++ likes to hide things from the programmer... There are so many cases of this, I won't even list them to prove my point. If you're a C++ programmer, you'll know what I mean.
If you're not a C++ programmer, then the best way to describe it is like this:
There was a Tom and Jerry cartoon where Tom finally catches Jerry in his hands. As he peeks into a hole made by his fists, he sees Jerry peeking into his own tiny hands. Tom is curious what is in Jerry's hands and tries to look, too. Jerry pulls his hand away and hides it out of Tom's view. Now Tom is really curious and has to kindly ask Jerry to show him what he's hiding in his hands. Jerry then gets his fist near Tom's eye and then gives him a big sucker punch in the eye and runs away.
Tom is the programmer (you) and Jerry is C++. You *think* you have control. But when you want to look very closely at things, then Jerry won't let you. You have to do a few things "against the spirit of the language" in order to get your work done (or else have a very costly rewrite for very marginal additional features.) After you have done this dirty deed, Jerry will sock you in the eye some time later. You don't know when, and you think you got away with it, but it'll happen... usually before a critical deadline because that's when the highest volume of code changes occurs. Of course, you feel kind of dumb that Jerry did this to you. But there are so many countless ways, you can always get caught by a new one, and then eventually he tries an old trick on you that you forgot about. An experienced programmer will sort of just accept that this abuse is part of why he gets paid so much.
C++ is like this Tom and Jerry cartoon where Jerry sucker punches Tom in the eye. Until we invent a language that doesn't do that, we will be stuck in this prehistoric age where future generations will look at our existing programming languages in puzzlement in the same way as we now look at doing math in Roman numerals as peculiar and unintuitive.
Whether the code itself is interpreted or native compiled is irrelevant to our progress in software development.
You would think that by now someone would have invented a better language to replace all of our existing ones. But then again, you would have thought that the Romans would have invented a numeral system that allowed them to progress in mathematics to a point where they could understand how their multiplication tricks worked:
http://www.phy6.org/outreach/edu/roman.htm
But that never happened, and similarly, Western civilization may expire before we have a competent programming language.
I think Eve Online (in its current state) goes to show that interpreted languages can be a favorable choice to develop in. From what I have read, it uses Stackless Python extensively, which is what they are claiming makes the online game as fast as it is (c/c++).
To be fair, delegates (which is most likely what is being discussed) are not syntactic sugar. They're a feature of the CLR allowing one to treat functions as objects. Although Java and C# are not very different languages (to say the least), delegates are a language feature of C# that Java could really use (many people use anonymous classes or lots of seperate classes with single methods to achieve what can be done with simple methods in C#), particularly for GUI functions.
I agree though; "syntactic sugar" is a term that is bandied around altogether too often. Syntactic sugar is accused of reducing a languages base simplicity to gain the advantage of making a specific use-case simpler, but it's not as simple as that in practice. Some "syntactic sugar" extends well universally and acts to enhance the language — it's a question of good design.
For numeric intensive code it's more like a 3x hit for .NET. And yes, I have test cases that measure that.
Ian Ameline
I'm sick of cliched sensationalist articles with the sensationalist titles, how about you?
.NET this is pretty easy: "unsafe" sections and "managed" sections can originate in the same project and even the same source code, so you can optimize those critical 10% of your code where 90% of the time is spent (you prolly know the cliche), and use managed to take benefits of the advancements in the platform.
As always this is a non-existant problem hyped up by people that don't have a clue.
First, the performance hit of managed code is not "negligible". For tasks that rely on raw math power it can be significant, like 3D engines, data processing and so on.
But if you're doing, say, a rich client, your code will most likely just call existing multimedia, communication and input API-s. Then managed code's performance hit is next to nothing since most of the time is spent processing the commands from the API-s, not your own code anyway.
Thing is: can we drop the raw power of native code and go all managed: hell no. And we never will. While plenty of consumer applications have good performance on managed code, there will always be a class of professional software where 20% better performance means potentially tens of hundred of dollars saved for a middle-sized company.
But the big miss in the article is that managed and non-managed code can coexist. In
So wait, we were talking about end of what again?
Try 2x or more speedup. See the Programming Language Shootout.
While a good question is posed, I the answer it easy to see. Just think back a few years, when the current thinking said "If you want it coded right, use assembler". Soon C came into fashion, and then a host of "higher level" languages. If an interpreter fits the bill, they'll go there, albeit a bit cautiously. When programmers are forced to do more and more, in each piece of code, they'll seek the clearest path to that goal.
Dont say ITunes is fast man...i am on AMD64 3200 with 1GB of ram(Win XP) and what not...and it is slow..Amarok or Bunshee runs faster on my inferior notebook.r
Are you going to compile new binaries for every architecture and combination of cores?
As a Gentoo user that is an emphatic yes!
an ill wind that blows no good
In my college years I would have been seriously against the idea of not programming Native. I was a huge C/C++ fan and thought that programming languages such as java were evil. But in all honesty... These days... Programming in C/C++ is more of a pain than it is worth. They (and most nativly compiled languages that I know of) fall (far) behind languages such as C# and Java when it comes to ease of maintenance and OO prettyness (yeah C++ supports OO but ANSI C++ OO is fugly). I'd hate to say it but the only people who should be working with native are the folks and Microsoft, Apple and the OOS community. Developing operating systems and programming tools to allow the rest of the world to not deal with the uglyness of native code.
What is this? Now we want to dumb down our future? No matter how fast processors evolve it's always better to porgram them natively! My Dual Core G5 screams, especially when you take advantage of the altivec core.
I guess some people are worried about what happens when more people can harness the pwer of the microprocessors comming up.
Jack the ripper screams on my dual core G5. Yes I run Linux on my g5 as well as OS/X. Dsniff works great as well.
remeber, when it comes to code, GO NATIVE!
Sticking feathers up your butt does not make you a chicken - Tyler Durden
Why wasn't the whole stack written in perl?
.NET (and I'm sure other languages), it's hard to write un-anylizeable code (though with the advent of XML and xdoclet it's getting easier). Note that I didn't say unreadible or unmaintainable.. In Perl you can load a module which forcibly redefines many of your functions.. This is not only feasible, it's common practice.. Now "good practices" says a module should use cooperative symbol injection (meaning the caller asks for symbols to override). In C++ you scatter the definition of your methods throughout many classes using the a::b::c syntax to pull them all together.. Convention reduces the propensity to abuse this, but it's still common practice to use include-file magic to completely alter which methods are compiled in. Java does use reflection and proxies more and more, which are just as bad (and often uses XML to define when/where/how to use such proxies). But this at least only provides "deviations" away from the base code; and more importantly is similar in effect to generalization-specialization... Since OOP often has you over-riding methods, reflection is more like dynamicly coded specialization. So it's no more inelegant than multiple overrides which OOP commonly allows (not aware of all the implementations of OOP)... Of course, you could always choose to say OOP should only ever specialize each method exactly once.
Ok, what about SQL.. That's not even JIT'd. What about about the startup process.. Why isn't that compiled directly into the kernel? Boot-up-times could be insanely fast.. Hell, you could even embed the mysql and apache and slash-code directly as a kernel module (a la tux)... You could have slashOS.
Obviously separation-of-concerns plays a role in these decisions.. But more importantly is the UNIX mentality of tool-boxing. Each language performs a single role (ideally) and each module is built out of the most appropriate tools (including language).
If 90% of the "Thinking" goes into the web request and the database reconciliation, and those aspects of thought are VERY uniform and consistent across all applications, then they BELONG as raw mathmatical code (e.g. c or pascal or take your pick beyond my expertise). Since there is no varyance, there is no benifit in JITing them every time they launch. Incidently if apache or Mysql were done in Java (i.e. hsqldb and tomcat), I doubt there would have been any performance hit, as both apache/mysql are services which have long live-runs, so load and JIT time are neglegable compared to boot-time.
The thing that should be scripted is what is most highly deviating between deployments.. Obviously shell-script being the most crude of the available languages (perhaps surpased by the non-Linux VB-Script), or maybe PHP (which I know many sys-admins who do shell scripts via PHP).
Perl is a fullly featured language (and if you don't believe me, try comparing it to bash and try to escape every possible string, and get back to me). This fact makes perl better than AWK, SED, grep or [ba]sh to do full system programming... Now I would argue that perl doesn't scale well into large projects (code-management wise).. It's harder than C to anylize since almost everythign is symbolic and has side-effects (the fact that whether you last referenced a scalar as a string or integer affects what it does when you concatenate is a big element-of-surprise when performing data-encapsulation). But single-focused applications like bugzilla or even slash-code are perfectly fine to write as perl applications.. You don't have unrelated application-level modules being brought together (meaning while IO::File is a module, it's purpose is to be reused, whereas bugzilla-preference-manager is not meant to be used for anything other than bugzilla... But the author is forced to be aware of the bugzilla-list-bugs module).
With Java and
Someone else's comment about google spread sheets being butt-slow is not an issue of throughput, but latency (both being elements of
-Michael
That's why optimizers use heuristics.
Patrick Doyle
I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
If your native code is running as slow as interpreted, I would really recommend getting that looked at. It would seem that people are losing the ability to write clean code since the crutch of interpreted languages is hiding so much of the finer grains of computer science.
First of all, when experienced programmers write big systems in interpreted languages, you can rest assured that they know what they are doing and are doing the benchmarks to make sure they aren't losing performance where they need it. If they need special, high-performance algorithms or libraries, they will figure out the minimal set of C/C++ primitives they need and make them a native code library inside the scripting language.
And whether code is "clean" really has nothing to do with the language. People can write clean Perl code and unclean C code.
Finally, "the finer grains of computer science" are absolutely and positively not concerned with the kind of low-level mess that C exposes.
I'm currently working on learning SDL in C/C++ for exactly that reason.
Good, so you are in a very early stage of your development as a programmer. As you mature, you'll figure out how to get the job done without wasting all your time on C/C++ programming.
In general, when experienced programmers use languages like Python or Ruby with native code plug-ins, or when they use languages like Java or C#, they produce code with better performance and fewer bugs than straight C/C++, simply because they end up having more time implementing good data structures and focussing their efforts where it counts.
If the trend is towards virtual machines, why are we using emulated virtual machines? Things like VMware are taking off, and Intel has Virtualization Technology (TM) that essentially allows a program to run another protected mode task, with any privilege level, and simply trap any privileged IO operations. If any mainstream OS implemented it right, they could basically do what "386 Enhanced" mode did for older programs, and sandbox them while running at full speed for the rest of the code (that doesn't require interaction with the sandbox to decide whether it's okay, or redirect it to host resources).
ttuttle is a rankmaniac
I'm an engineer and I regularly write programs that my PC fails to "laugh off". End of native code, my butt.
I used it + some funky header files + some perl-fu to convert some c to java. Just to see if it was possible. It works, and it was nice being able to type main() and get it replaced by the proper class designations, scoping, etc., as well as much simplified syntax for other stuff.
One good use is to use a script to replace all the "include('filename.inc')" stuff with "cat filename.inc.php >> target.php". No more .inc files, and only 2 hits to the filesystem on the server (1 to read the dir, one to read target.php') as opposed to the usual dozen or so ... and you can include a command to strip all the comments and extraneous whitespace from your target.php while you're at it, making it load and run slightly faster, then move target.php to your ftp upload dir (or even automagically ftp it to the server if there are no errors).
Just don't use it to embed your common css or javascript in target.php - its better to pay the penalty for an extra couple of file reads on the first hit, and have the user's browser cache the result for the rest of the browser session :-)
There are several reasons.
.NET have already far surpassed Java desktop usage on their respective platforms (and Mono makes both sets of APIs cross-platform if you want).
.NET is a better platform for developing Windows apps anyway.
(1) Java's market presence for UI applications has been decreasing: applets have largely disappeared, and the JRE is preinstalled on fewer and fewer desktops.
(2) Even on OS X, where Java is pre-installed and exceptionally well supported and integrated, there are few applications written in Java, and even fewer written in Java using Swing.
(3) Java's UI classes don't integrate well with native desktops, and it is impossible with them to write a cross-platform UI that conforms to every target platform's conventions.
(4) Within the span of just a couple of years, Mono and
(5) Sun's licensing and compatibility requirements have made Java unattractive for Linux desktop distributions, and it seems doubtful that that will change (it looks like Sun may open source their implementation, but the specs will probably remain restrictive).
(6) As far as cross-platform GUIs go, the most widely used tools are wxWidgets, Qt, Tcl/Tk, and Gtk, plus their various language bindings (even Eclipse uses its own toolkit, not Swing).
But at some point Java/Swing programs will have accumulated enough performance and features that they are good enough for what people want to do, and they have the added advantage of not being tied to Windows.
And that attitude is why Java/Swing isn't succeeding. As a Linux and Mac user, I don't want cross-platform scraps thrown to me, I want high-quality applications that integrate well with my desktop. And given that people are creating those based on Gnome, KDE, ObjC-Cocoa, and Mono, I have no incentive for using Java applications. Of course, Windows users don't have any interest in third-rate Java replacements for their native apps either, and
Even better, the Gnome, KDE, and Mono apps even run on Windows, so that even Java's cross-platform aspects are uninteresting.
SUN seems to be in this Java business for the long haul,
Well, that's another problem: I think many people are unconvinced that Sun is in anything for the long haul; the company has serious problems.
Like the parent says - It Depends.
(1) What is the target application, does it have latency requirements? You may not want to use Java if it does - or program like your writing code for Javacard or J2ME (Create your objects at startup and don't just new yourself into GC hell).
(2) You probably want to think about the algorithm first. A 100x faster native CPU won't do much good if your algorithm is coded O(n!) vs O(n^2) on the interpreted platform.
(3) Bandwidth is money, latency is forever.
(4) It was once said that LISP / PROLOG were too memory hungry. Big Institutions could afford memories of say 4 MB and fast CPU's. Now you quite possibly have more than 5 VAX MIPS in your cellphone and more memory than that late 70's / early 80's VAX too.
Here's a final question. Suppose your requirement was to write the embedded code for a medical radiation therapy machine. The machine has to: 1) Turn on and off the beam. 2) Rotate the beam around some axis.
Screwing up could mean fatality. What language / environment would you use then? Imagine your loved one has to lie on this thing.
Java with the GC possibly getting in the way?
C? -- Pointer smashing?
C++ -- Ditto...
Lisp, Mercury, Erlang, Ada, Modula 2, Eiffel, Assembler? No software?, hardware? / a finite state machine?
Hint for googling: Therac-235.
ScottGu's Blog: Handling 1.5 Billion Page views per day using ASP.NET-2.0
Rather then writing efficient and powerful native software, write system crippling interpreted applications so that you never realize the fullest potential of your brand new hardware? For what purpose, so that you can write an application that targets both 90% of the worlds Windows users on PCs AND the other 10% of mismatched users using alternative *nix based OS'es on a variety of hardware?
Sorry, as a Windows programmer, I will target the 90% and forget about the rest. I will earn a good living making native Windows software without worrying about crippling my software so that it can run poorly on the other 10%. If Open Source advocates create a Wine or other Windows emulator that can run my software, good for them, I will even optimize my code so that it runs more efficiently under Wine, but I will not abandon my largest marketshare by crippling my software in order to cater to the other 10% who don't believe in paying for software.
Vista will offer me a whole new level of expression and creativity, using their native API's. I am no longer constrained to creating apps with static grey boxes. Making a cross platform application, most UI is terribly utilitarian and uninspired. While there ARE exampled of decent cross platform applications (FireFox) for instance, most shareware open source software is crap and pure examples of why you need to define a target market rather then trying to appeal and cater to everyone.
Java still isn't improving. The few Java based desktop applications I have tried still cripple a reasonably powerful Dual Core AMD system. I mean, the system becomes sluggish and almost unusable if I have th Java applications UI visible. As soon as I minimize the Java application, the system snaps back to full speed. When Sun can make Java run as fast as native code (or even come withint 90%) without crippling the OS then I would consider using cross platform interpreted code, but not until then.
I have only ever found python to be effective for writing quick system scripts to perform repetitive tasks. I would shudder to have to write a actual application using the script language.
I don't see the end of native code any time soon. The argument that just because you have a beefy system that can run interpreted languages quickly isn't sound. I bought that beefy system so that I can maximize its effectiveness, not just make do with software that runs at 50% capacity, even at optimal conditions.
Why hasn't someone created a Java co-processor? I mean, create a hardware bit that can be slapped in as an add-on card, or embedded on the motherboard to run Java as fast as running native code on general CPUs? I mean, if Sun was serious about Java as a universal cross-platform language, then why not put some of their hardware development skills into making a Java co-processor. In the worst case, you have to run Java as a software virtual machine, but if you believe in Java and want it to succeed, then you will buy the co-processor and run Java in an optimize hardware machine.
I haven't thought of anything clever to put here, but then again most of you haven't either.
Who cares that it never does what it seems to do -- that's not a useful piece of code. Why would you write something like that?
JIT compilers aren't "interpreters", they are real compilers. And not only do they not "struggle" with optimizations, they open up the ability to perform optimizations that batch compilers simply cannot reasonably perform. For example, they offer template instantiation without the bloat associated of C++ templates, they perform dynamic method inlining, and they optimize code for the specific set of processors and communication hardware available on a given piece of hardware.
The profusion of architectures, as well as extensive code reuse, are what is increasingly driving JITs, and the more complex and parallel hardware gets, the more import JITs become because batch compilers are hitting a brick wall there.
Ah, if it only were as simple as "Java is 5% slower than native". Unfortunately, performance can't be characterized that easily.
In real life, Java is as fast as C/C++ on microbenchmarks.
In real life, Java is also often slow as a pig, not because of the byte code or JIT, but because of the way class loading works, the way JNI works, library bloat, and lots and lots of other problems.
Java has given a bad name to JITs, but it has also demonstrated their potential.
The languages used may have changed, but the amount of (and use cases for) interpreted vs. native code hasn't changed that much over the decades. Shiny-new Java didn't change it, neither did .Net. Nor will Ruby on Rails. It's the same old song, covered by some fresh new 'hip' band.
If you lump together Java, C#, and interpreted languages, you really don't know what you're talking about. Java and C# are natively compiled languages, they just happen to perform compilation at runtime.
And for high performance computing, that's the future, because that's what's needed to adapt software to the specific hardware and data you have; batch compilers simply can't do that.
Java itself has lots of problems for high performance computing, but don't confuse a particular implementation with the approach. You'll likely see JIT-based Fortran implementations become widely used in the future and Fortran-specific JITs for high performance computing.
I've been writing business applications exclusively in PHP for almost 4 years. WHen I attended PHPCon in 2002, Rasmus Lerdorf was the keynote speaker. During a question and answer session, one attendee asked about the limitations of PHP in computationally intense situations. Rasmus said to write your business logic in C and call those binaries from PHP. Since that time, various PHP compilers have emerged which may may or may not make the whole issue irrelevant. I've never felt it necessary to either write external C routines or compile a PHP app because the apps I've written perform acceptably on commodity hardware. I love C and C++ dearly, but writing userland business applications in C is just way too much hassle.
But what interpreted language can I use to write a device driver? Or a web browser? Or an operating system?
Interpreted and compiled languages have coexisted peacefully for decades. It is reasonable to conclude that they will continue to do so.
I personaly would like to see a language that has the ability to be both interpreted and compiled. That way you could have the best of both worlds. If you need the low-level functionality certain parts could require compilation if used, but if you just want something quick and don't need that access you could interpret it. This would reduce the need to learn as many languages, and would make for a powerful platform for programmers. Now all we need is an able bodied group to come up with such a language.
The greatest of all weaknesses is the fear of appearing weak. ->JB Bossuet, Politics from Holy Writ. 1709
Working in a LARGE corporate environment, I see this entire discussion as moot. Corporations are trending toward the complete elimination of GUI desktop apps in favour of RIA (Rich Internet Applications). Write them once, run them anywhere. Traditional BATCH processing is accomplished through services, daemons and objects.
Java's place in on the server. JSP is OK, but I wouldn't want to write full-blown RIA's in it. Look at FLEX or CF for your front-ends, then write the objects you need in Java to support you RIA front ends and appropriately represent your backend. J5EE with all the new Hibernate stuff, Generics, etc... as well as the stuff in the new concurrent package give you so much power and flexibility in writing FAST, solid, flexible frameworks, why would you want to use anything else.
Opinion:=TMyOpinion.Create(Me);
What if every piece of software was written to use the minimal amount of ressources needed to do its job?
As a professional game developer, I am amazed at how slow my favourite PC apps run these days, native or not. When I can do physics simulations, AI, complex animation, networking, and render 10 of thousands of objects with tons of processing to set them up, all in 33ms, on the PSP's 222Mhz cpu with 24Megs of RAM available to me, Why the hell does my Azeureus take 20Megs of my 512Megs of memory and 3% of my 2.8Ghz, even when I'm not downloading anything!!
I am sick and tired of lazy developers wasting cycles left and right on the assuption that the machines are so powerful they shouldn't care. imagine if gas consumption and cars were thouht of the same way.. And these developers then assume they own my machine.
Have you ever tried running Azureus, Maya, Visual C, Media player, outlook, some RSS feed thingy, an Antivirus, Google desktop, Trillian, Picasa, Word, Excel, ITunes, Photoshop, Google Earth, and a bunch of windows in firefox, all at once, and all of them being responsive and super fast? No Way!
But that's what my system should be able to handle if apps were written properly, and still have enough idle time for the SETI grid. These apps should be able to load and close in less than 1s too.
And no, don't listen to the BS about unnecessary optimization will slow down development.. it's all about common sense and good architectures, and not releasing the first test code that works and call it beta forever.
Stop the waste cycle!!
Give me native code over interpreted code any day! End users (at least the ones with knowledge of such things) are always complaining about code bloat and how, in spite of improvements in hardware speeds, software always seems to be running slower.
I think it's time to go back to native assembly programming.
- Any decent C++ programmer will always put the OS-specific code in an abstraction layer. C++ has many ways of allowing this, ranging from macro's to templates and everything in between. These features even enable portability without sacrificing speed, since the choice of function happens at compile-time. So this so-called portability issue just doesn't hold.
- For a lot of applications, optimal performance simply is the only way to get the job done. JIT Languages often have high-level objects providing functionality that takes lineair time where one would expect constant time performance. Building these objects yourself int a JIT language simply isn't going to make things run any faster, since the atomic components have to much overhead to be good candidates for such low-level operations. C++'s STL templates on the other hand have well-defined operation times. By the way, these lineair/constant time issues won't just go away as computers get faster.
- With JIT-languages, you have no control over the underlying virtual machine on which the program will be running if it's a program that will be downloaded by many people and run on a client machine. If that VM has a security flaw, then your program will have one too. With precompiled programs, you can choose your compiler and have full control over security. You can even decide to link statically to minimize the number of external dependencies that could be a security threat. He who controls (or manufactures for that matter) the VM also controls your program. God knows who's out there wanting your program to be less performant than theirs. And how will you ever find out?
And finally, just take a look at topcoder.com to see what programming language is used most by the people occupying the top 10 highest ranks. It's not a JIT language, but C++. That alone says a LOT to me.
Am I biased? I've written in both C++ and C#. While I even enjoyed writing in C#, I never felt the power as I felt while writing in C++. True, for every downside there's an upside to the JIT languages, but IMHO, the cons of the JITs just don't weigh up to their pros.
Native code will and should always be around.
And what if there's nothing behind the door until it is being opened?
We know that native assembly and low-level compiled code always tends to be faster. We know that JIT/interpreted languages provide a great tool-set to work with (reuse, reuse, recycle). Sure one could make arguments on both sides why these aren't true, and why one truth could apply to the other. The real questions aren't being asked here. These questions need to be asked:
1) What added value does the JIT/interpreted code base bring to the table for end-users (not programmers)?
2) What added value does the native code base bring to the table for end-users (not programmers)?
I think there are many value-added propositions when both questions are answered. The truth I think is that we can't live without EITHER model. IT benefits from the JIT/interpreted codebase, and mathematical computation applications (games, science, etc.) benefit from native code.
There is a place for both in our world. Let's just accept this and move on.
Native code is going to always be around. Someone has to WRITE the Virtual Machines. C is STILL valuable after all of this time.
.Net Virtual Machine will still need programmers to write them and add to them. Kernels will still need to be written and X windows will still need to exist.
What you WILL find is that applications programming may all switch to Java or C#. The reason is it is very hard to have some of the traditional problems with programs with a properly coded JVM. Sure, buffer overflows can happen in the JVM, but it's way less likely to happen in Java/C#. That means the applications will need less work over time. With that said, the JVM's and the
Gorkman
Can you clarify this? You mean SIMD functionality was available in some (which?) CPUs _before_ SIMD instructions were added to the specs?
http://www.dieblinkenlights.com
If Microsoft wants to demonstrate how fast managed code is, then why dont they write their drivers and their lower level os in managed code? But, as you'll notice, they don't. There are reasons for that - its just not fast enough, and garbage collection has too many problems (wasted memory, pauses, etc)
I had a pentium 2 233 with 64 megs of ram and a 6 gig harddrive. I primarily used my computer to run windows, ms office, diablo, IE and Netscape, winamp, and an antivirus program. Today I have a brand new computer and do almost the same thing. I run a "better" version of windows and office, I have a "better" video game or two, I run a newer improved IE and Firefox, still have winamp but its "better" than the v2 I had, and I have antivirus from the same company. The only thing new is a divx player. So how come with 10 times the processing power and 8 times the memory and 50 times the harddrive space its not really all that much faster and in some ways it slower. Could it be how things are coded these days. No that can't be. Newer is better.
Delegates are *really* arrays of function pointers that have the conveniant notation of being able to call the entire array with one line of code. This is handy when thats what you want to do (event/subscriber pattern). Its horrible when you actually want JUST A FUNCTION POINTER :)
Religion is a gateway psychosis. -- Dave Foley
As much as I'd love to love Java, and as much as I know most people would if it truly delivered all that it promised, there are a lot of issues with it that can tend to cause problems. One example that bit my company:
d =4263113d =4912686
Our company writes and sells a large medical imaging archival system, and one of the components of it is a web-based front-end using Tomcat, which accesses the backend database for pretty much everything.
Recently a feature was added to our software which opens a database connection to the various other servers in the system to check the status of their queues. This worked fantastically in testing, but when it was deployed, we found sites whose frontend became completely unresponsive.
After some digging, our developers found these:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_i
http://bugs.sun.com/bugdatabase/view_bug.do?bug_i
The long and the short of it is that JDBC calls (DriverManager.getConnection()) are sychronous, meaning that you can only be opening one connection at a time. This works fine in an ideal circumstance, but if one of the hosts you're trying to connect to happens to be off the network, then all threads in all apps in that JVM have to wait before they can open a connection.
As a result, when our background thread cycles through the databases to check the status of their queues and comes across a down server, DriverManager.getConnection() blocks - for three minutes! - while the TCP connection times out. This means that our entire application locks up completely, since every action requires a database connection. Sun's response?
'Introducing a change such as this risks breaking existing applications that have come to expect this behaviour.'
I like Java, but problems like this are just absurd. In C, I could either rewrite the library, or (preferably) change the source of the existing library. Failing that, I could fork separate processes instead of threads (ugly and inefficient). In Java, I don't have this option, because it affects the entire JVM. Fortunately, there is a workaround, but it's not a particularly fantastic one.
Java/C#/etc have a great deal of benefits over C/C++/etc, but there are always going to be problems as long as someone else decides what should be fixed and how. The real question is whether or not, for your application, the benefits outweigh the (potential) drawbacks.
I am seriously looking at Java/Swing as the next wave of what started as DOS/Turbo Pascal and got reimplemented in Windows/Delphi.
.) As a former J2EE developer, let me also state that Sun is very slow with fixing critical bugs, and many more of those bugs appear on typical desktop applications than the server.
If you are looking for the next One Great Language (as I was last year) I'd strongly urge you to look beyond Java for a few practical reasons:
1) Sun and IBM may be gung-ho on Java, but it's losing ground compared to Python, Ruby, C#/Mono, etc. (Check this out too: http://oodt.jpl.nasa.gov/better-web-app.mov
2) As a language, Java is "OK" but not all that great, and it doesn't look like it's going to get much better over the next decade. "Better" in this case means how quickly you can write good abstractions.
3) Its lack of a Java-certified yet free-as-in-speech runtime stack is a problem. I wouldn't commit any of my future livelihood to the sufferance of any vendor, Sun or otherwise.
4) Java doesn't integrate that well with non-Java code. JNI is a pain to use (I've done it), the APIs that do talk to the OS are lowest-common-denominator and hence usually incomplete for any serious work, forcing you into JNI. If you're going to use a platform that insists on a clear separation between its runtime and the underlying OS, you may as well go with Lisp and at least get multiple free implementations and serious language abstraction.
Anyway, I'm not trying to preach here, Java's got a great place and powers a lot of the world. It's just (to me) not a good choice for the One Great Language, he one that you switch your primary problem-solving-think into. It would be like deliberately choosing to use Cobol in 1988 when Turbo Pascal was already available.
I'm one of them: The early Java GUI tools were a well-thought-out abomination that sent droves and droves of developers in search of better solutions. A lot of them saw VB just sitting there, and all their customers were on Windows anyway, and now Java's in an irredemable hole as far as GUI development goes. This is good, because innovative projects often start as a reaction to suckage elsewhere.
So Java itself will never make a serious dent in the realm of GUI clients. The reason is very simple: AJAX and SaaS are using the interface provided by the browser. Browsers have reached a capability threshold that is making them the client-side platform of choice.
We're reaching the point where, as far as desktop machines are concerned, the OS simply the framework for a windowing system, and the windowing system is simply the framework for the browser, and all HCI will happen in the browser. Sure, the server-side of the app may reside on the same system, and be written in just whatever language happens to be there, but all it will do is exchange XML and HTML with Firefox.
The OS is becoming an afterthought, and the Windowing system is an afterthought with skins. The browser is where it's at, and MS is gonna be hurtin' if people see Vista as merely the tool behind the tool behind the tool they use to get their jobs done.
This is not my sandwich.
article here
MS-Windows Vista's system requirements means that future Windows boxes will laugh at the memory/processor requirements of current interpreted/JIT compiled languages
That is, of course, unless it is the consumers who laugh at Vista's absurd requirements, and just stick with Windows XP. Anyone who wants the pretty eye candy can just spend a few bucks for Stardock's Object Desktop, which works without the hardware investmnent. As for the so-called security enhancements, we all know that, for every vulnerability fixed in Vista, Microsoft will introduce two more, thanks to their Insecurity By Design principles.
So the assumption here is flawed. Vista will have little or no impact on memory/processor power out there in the real world.
"My country, right or wrong; if right, to be kept right; and if wrong, to be set right." --Senator Carl Schurz (1872)
Short and simple, interpreted/virtual machine code has its place, but it does not make porting easier. Simple programs can be written in *any* language and be easily portable, obviously, some more than others, but all pretty easy.
Once you get in to complexity: memory constraints, performance constraints, large processing, and so on, interpreted and vitual machine systems directly impact the viability of the code. A virtual machine or interpreted system can use more than an order of magnitude more resources than a well coded C/C++ program. If your program is a couple megabytes, well, 20 or so megabytes is not too bad for Java. If your program takes a gig of RAM, then 10 Gig may make your program unworkable.
Then there's porting, don't get me started. Most of my time coding in "portable" java is figuring out the differences in the different virtual machines.
Like I said, an easy program is easy, almost any language and environment will do. More complex programs require more direct control over the actual processing.
Actually that's only true of multicast delegates — there are some which only ever point to one function, although they're obviously not used so much since the main use of delegates is the event/subscriber pattern.
Of course, there's always the issue that function pointers, in most implementations, are inherently unsafe, so they're quite hard to wedge into a "safe" language like C#. It's one of those quandary things. I'm not convinced that, in the paradigm that C# implements, there's all that much use for function pointers as it is, though.
JIT compiled languages give you native binaries... don't group .NET with python, et al - it makes no sense to do so.
Do you really not understand the difference, or are you simply a fan of some of the interpreted languages and are looking to manufacture some sort of fake equivalence as an excuse to use them?
Your argument amounts to "we will have a huge amount of ram and CPU cycles, therefore we can feel free to waste them on interpreted code rather than compiled native binaries". Huh? Good luck with that - I am sticking with .NET and C#.
You're not really asking about interpreted vs. compiled languages. What you're really asking is whether computers have gotten fast enough for us to stop using low-level languages and let the computer handle many of the details in high-level ones.
But, I think the whole question is bollocks because it's based on an incorrect assumption.
There is no inherent tie between LLLs and compiled code, and HLLs and slow, interpreted code. Some HLLs can be compiled into very fast native code. A quick scan of the comments tells me that the name has already been dropped, but I'll put in my plug for Common Lisp. It allows you to use interpreted functions and compiled functions both in the same environment, so that you can develop code quickly, then compile it to get a speed boost. If you need more low-level control to get some extra performance in a bottleneck, you can even do things like declare data types and lower compiler safety levels for individual functions.
Lisp was doing this decades ago, and it was even being used for operating system code in the Lisp Machines. So, computer power really has no relevance to the issue. I think the real barrier to adoption of these kind of high-level techniques is not in the machines, but the beliefs of developers who still think that real programmers do thier own pointer math.
--WH--
I am a Pascal programmer from ancient days
I'm sorry, you lost me there when I spit out my coffee on my keyboard.
Pascal was a language written to teach people to code, not to actually
get work done.
Interpreted languages, or scripting languages as I like to call them, GENERALLY are real crappy with memory management, bloated, pigs of software.
Perl is a lovely exception.
But Java or Matlab or VB seem to thrive in using as much RAM as possible to get a job done. Any serious work I do in any of them I end up re-writing in C/C++ in order to streamline the RAM usage and make the program work reasonably.
And this is the main reason Java will not take over as a dominant desktop theme. People actually like programs to work and not lock up the machine and screech it to a halt.
Real programmers manage their own memory usage, and don't think of it as a nuisance, but as a mission critical objective, because too many scripting engines are REALLY bad at it. Java on linux is a great example. It is real buggy and locks up a lot, and cannot do ANYTHING without loading 250 MBytes of libraries into RAM. That's crap, and it will always be crap. It is possible to write scripting engines that do not suck, and when that happens in something like Java it WILL take over because programmers want their programs to work first and foremost, and secondarily want to code it quickly.
I'll add to this rather pointless discussion: We're talking about colloquial language here, which is highly region-dependant. Don't expect things to have just one meaning. For example this is how words are used in my region (Northern Germany, more specifically the Bremen region):
"North America" is a continent.
"South America" is another continent.
"Central America" is what's between the above.
"The Americas" is not used at all and most people would tell you that "America" is used in the singular.
"America" is an ambiguous descriptor used for either North America, North and South America or the United States of America. South Ameria is usually called by its full name.
"American" or "Ami" (say: "uhmmie") is an ambiguous descriptor used for an inhabitant of North America, an inhabitant of America (where the exact continent is not explicitly mentioned), an inhabitant of the USA or a large sugar cookie made from sweet dough related to the "Black and White" cookies that came to Germany during the occupation (cf. de,wikipedia.org).
There is no unambiguous term used to refer to an inhabitant of the USA, except for the term "US American", which is not used colloquially.
USE HOT GRITS WITH STATUE OF NATALIE PORTMAN (NAKED AND PETRIFIED)
Talking about bringing out the grinders. Anyway.
I agree that people are going to be buying ever larger and more powerful systems. Yes, this will make bloat less important. Yes, this will give jit type languages a bigger role in larger applications.
I'd rather the future become more charming. http://charm.cs.uiuc.edu/
Having to work for a living is the root of all evil.
There's another advantage, though: interpreted environments typically provide a great deal of introspection, reflection & dynamism. One can redefine functions & methods, extend classes, extend the environment and such at runtime.
And of course Common Lisp offers the portability & flexibility of an interpreted language with the speed of a compiled language: yes, it's a language as dynamic as Python or Perl (much more so, in fact) which is compiled down to native code. How's that for nifty?
There is a philosophical reason to go to a high-level for all this. If you observe evolution in all its forms it always goes from low-level stuff to high-level stuff (from tools making to society behavior, with countless examples in all fields like business, economics, etc). In our brains, it just make sense for us to always think in ever-higher levels, because if we had to keep track of all the previous details we'd spend more time dealing with details than with the goals of what we're trying to accomplish.
Note that this is nothing new in software engineering. Most software a few decades ago was written in low-level code, even assembly language. If you did a survey then about the ratio of low-level to high-level coding, and compare it to a survey today, you'd realize that we do not even ponder about where things are going, as there is plenty of evidence today to tell us that going higher-level is the path the software industry is taking.
Native coding will become more and more of a niche, first to do Operating Systems, Drivers, Kernels and such. But eventually I can see even a fully-operational OS being written in a high-level language. In a sense that's what's happing today when you combine all the Web Services and tools we find today on the Web.
So, it's just a matter of time before everyone codes in high-level languages, and even today's high-level languages will seem low-level by what we're going to replace them in the future.
The performance hit is not always negligible (there's a reason why numerical work is still coded in Fortran), and I'd like to see the "intepreted language" that has shorter development time and is more powerful than OCaml. And what's more widely available than C? Probably only BASIC.
Besides, being compiled/interpreted/something-in-between is NOT a property of a language but of a language's implementation. Use Haskell and you can choose between all three. There are more things than C- and Perl-lookalikes.
15 years ago I benchmarked assembler vs c for graphics code - c was 200 x slower.
Did you try a "compile via assembler" and see what the compiler was doing? There must have been something stupid happening.
The level of control you need as a programmer is related to the work that you are doing. If you are writing an O/S, low level network app, embedded system app, etc, then you'd better have the control afforded by non-managed code. If you are just writing web-based business logic programs then higher level languages are a better fit. Overall though, as they move languages to fit the lowest common denominator those of us that were forced to learn the lower languages will find their value increased. Not to mention that those understand the more diffcult programming concepts encompassed by managing memory or multithreading are going to better grasp other languages and complex concepts (if you don't believe me, study compliers and see how related all programming language concepts are).
Now who else thinks the first 100 comments on this thread are what make slashdot a venting forum for offtopic issues?
- Kal`Goblez
Well it's time for another opportunity for Java to take off on the client side. I think it might have a chance should a couple of things happen.
First, Sun needs to open source Java. There are tons of bugs in Swing and that section of the code could benefit the most from the open source community in my opinion. Sun has been negligent of Swing off and on in favor of more profitable ventures on the server or on mobile phone specific stuff. If, instead of voting on your highest priority bug on sun's dev site, people were actually able to *fix* bugs...If, it were set up so that new features could be added fairly quickly, Sun could see Swing swing into action. If they don't open source Java or have too much bureaucratic work involved, then Swing might just be left as a hobbyist prototype-like portion of Java.
Second, I wonder if SWT will catch on. Eclipse is doing some very good work with 3.2 and the synchronized release of several projects in Callisto (http://www.eclipse.org/callisto). They are making it easier to do SWT client-side apps. If they execute well and developers pick up on this, Java could also make it big on the desktop.
I think both have to occur for Java to really take off on the client side though. We'll see.
First, your interpreted language has to use "native code." Second, in applications that are CPU bound, like scientific computing, the overhead of an interpreted language is not acceptable. Third, the largest computer market, embedded processors, will, in all likelihood, always compile to native code.
No problem. First, look at Intel's first effort:
http://en.wikipedia.org/wiki/Streaming_SIMD_Extens ions
Now keep in mind that you can load 8 different values into the fpu, and issue one instruction to act on all of them.
MMX used the fpu registers. So did 3dNow.
Err... the first public release of Java was on 23 May 1995. There might have been some code for it in 1990, but it sure wasn't ready for release.
But the other dates you quote are first release dates. You're comparing apples & oranges.
(Admittedly, Java's was the longest period without public release... of the others, Ruby had the longest such period having been started in 1993) (All information from Wikipedia. Look it up yourself.)
"Perl is a lovely exception."
I am sorry you lost me there when I choked on my coffee. Perl is pathetic attempt at a good scripting language. Having learned several languages now I have to say Python takes the cake "I am a scientific programmer". If however I wasn't doing computational work I would almost certainly use Ruby. I hate perl. I despise Perl. Perl Sucks. Perl blows snot rings...bet ya don't know what a snot ring is do ya? That's becuase you program with Perl! j/k btw
I used perl for several years. I honestly hated it from teh get go.
what?
Plus I really like the ability to do pointer arithmetic. Can't futz around with pointers in java, so you're always taking the long road from here to there.
It wasn't that there ws "something stupid happening" with the compiler ... its that, for some repetitive operations on video card hardware registers you can take shortcuts the c compiler can't. It doesn't "know" enough.
Regardless of the negligible performance hit compared to native code...
...are just as powerful as languages that generate native code.
...current state of interpreted/JIT compiled languages?
Some of us work on projects where multiple orders of magnitude is not considered negligible. Anybody who's actually delivered software of any complexity understands this. Twit.
"Substantially more powerful in many cases" would be more accurate. And since there's no point in using any interpreted language that is not, I'd abbreviate that to "substantially more powerful" and be done. In other words, your attempt to sound neutral on the subject is transparent. Twit.
Uhm, don't JIT compiled languages output native code to be run? We could argue about whether it's better to compile early or late, but... And anyway, JIT compiled languages are really not much more powerful, if at all, than compiled languages. Java and C# are incremental improvements, at best, over modern C++. It's the interpreted languages that are really more powerful, so you're conflating 2 subjects. Twit.
Interpreted languages are very very useful. And there are also very many projects where they are simply not appropriate.
What about the English spoken in Wales?
It's British English; it's a standard throughout Great Britain, not just in England.
The real difference to me between compiled and interpreted is not the speed. It never really has been. It is the typing. There are areas where I want static typing, such as large architectures with many developers touching related code. Compiler type checking can be very valuable in such cases.
On the other hand in projects with more isolated nodules, lots of shallow glue, or quick turnaround prototyping, I like the freedom of dynamic typing.
Note that languages like haskell, Java, and C# really fit into the compiled camp, not the interpreted camp...and they are all static typed. JIT is still compiled. True interpreted languages are more like python, perl, lua, and sh.
I think compiled and interpreted are very complementary, and I personally like stack of python/C++/lua. Extend python with C++ which in turn embeds lua. lua is easier and faster than python for script embedding, while python is easier to extend and has more libraries for the orchestration/glue role.
I've not yet seen a virtual machine that was fully useful. The inform z-machine, java, Apple's early forray into running old Mac software on the PowerPC, the SoftPC that ran Windows on a Mac. They all had limits. While they can emulate a processor, they are still a virtual machine. While there's a certain security in running applications within a virtual machine (if theres a crash, it happens within the virtual machine and hopefully doesn't affect other applications, or in Java's case Java is prevented from greatly affecting the system at all) I'm not convinced it's worthwhile to market full-fledged applications written in virtual machines.
.NET. That, I'm sure cuts down on development time and opens their products to more platforms, but I'm sure it's limiting in what their developers can actually do.
I will have to say, however, that the enterprise software market has embraced the virtual machine. Many enterprise groupware apps are written in Java and
But England is only one unit of the collective that is Great Britain. British English is the standard throughout Great Britain. Great Britain is not England. It's also Wales and Scotland. Complicating the matter is that there are still Gael folk in Wales and Scotland, but that doesn't change British English from being the standard English throughout Britain.
t he_English_language
Look on Wikipedia and you will also find these variations of English within Britain:
English English
Scottish English
Welsh English
(among others)
Here is a complete list of dialects of English:
http://en.wikipedia.org/wiki/List_of_dialects_of_
Note how many dialects there are within Britain!
right, but that wouldn't have made a good joke ;)
there is no need to sign your posts. this isn't usenet. your username is right there above your post. stop it.
lol I guess I wasn't thinking correctly. I meant hard drive :-p
C and C++ are just poorly designed languages for medium to large projects. The problem isn't native code, it's language design.
My current favorite language design is D (Digital Mars D). Unfortunately, it's still Beta and doesn't have any libraries to speak of, and won't link to GCC libraries. (There's an offshoot of it that will, called gdc, but building it requires recompiling gcc.)
Python and Ruby are very nice languages, but I would prefer not to choose them, and take the performance hit. Python, however, at least has the libraries (and so does Ruby in some areas). Python and Ruby are nicer languages than D, but they intrinsically have the performance hit of an interpreter (virtual machine). This causes much problems when you are trying to multi-process your code. So far my best answer is multiple independent processes that communicate over sockets...at one VM/process...I'm really hoping that D either matures rapidly or acquires the ability to link to gcc C libraries. If your code slows by a factor of two every time your processor speed doubles...then you aren't getting ANYWHERE.
I think we've pushed this "anyone can grow up to be president" thing too far.
Take a look at Erlang, it's an interpreted language from Ericsson and can support that sort of load. It's used mainly for soft real-time constrained, telco applications. There's an old video demonstration of the language available here.
Hehe, I figured.
That said, I'm running the mldonkey p2p client (does a whole variety of different networks, including bittorrent) and its sharing some 60 or so files and downloading another 50 or so. It currently needs 30mb for the core, and another 35 for the gui if I want to run that.. Which is quite a bit less then Azureus in similar circumstances it seems.
For all I can tell, the reasons for this is not so much java as a language but the universe of libraries and junk that comes with the typical jre and the fact that using a garbage collector without too hefty a performance penalty (or a gain at times even) requires quite a bit more memory.
There are still heaps of amazing stuff released on the demo scene. And the scene is trojan and virus free.
Fair enough. But C does provide about as little abstraction as one can expect from a language. I would argue (with some expectation of objections) that the greater the amount of abstraction, the more functionality a programmer can readily keep in his head. Say you have a subroutine that you can do the simple, slow, easily understood way, or do it the blazing-fast, well optimized, difficult to comprehend way. Which one you go for depends on several things, one of which is, "how likely is it that this code will need to be modified in the future?" If it's nice and modular, and you can wall it off so nobody need touch it again (and the performance boost is worth it) then go ahead, and shut the door behind you.
On the other hand, if it will require future programmers to understand and modify it, and you still need the performance boost, then the additional inherent complexity the programmers will have to memorize necessarily comes at the expense of something else.
Therefore, I believe that a simple, easily-grokked codebase is important. I think interpreted languages (esp. my favorites, Python and Ruby) allow for such simplicity. It might not be an overriding factor, depending on the job. But it's something to account for.
You want the truthiness? You can't handle the truthiness!
Perl is very C oriented in its syntax.
I shouldn't have excluded Python. Both Perl and Python are reasonable in memory management, as in a simple "Hello World" program doesn't require 250 MBytes of RAM to execute.
Others, not so much, ESPECIALLY Java.
I do mostly scientific programming, I use Matlab for a lot of quick and dirty stuff, Perl when it requires a little more programming, and C/C++ for any real heavy computing because the others are JUST TOO SLOW. There is no good reason that Matlab or Perl or Python should be 10 times slower and use many times the RAM as C/C++, but they do. And Java is a complete memory hog, off by an order of magnitude.
Speaking of Erlang, have you seen the video?
A good example of that, consider Azureus. Say there are 500,000 Az users on the planet and say a 2GB memory stick costs £50. Thats £25,000,000 spent to account for the use of crippling Java. Now consider uTorrent, it will run on a 133Mhz machine with 16MB of RAM. You've actually saved people a lot of money because machines that were previously rendered useless due to the spread of intepreted and JIT code have now been given a use because uTorrent can run on them. Personally I'd pay money for uTorrent because I like to multitask and thats entirely impossible with Az taking 2.5GB of page file on XP on a machine with 1GB of RAM, just a pity that theres no Linux port but I can run Linux in a VM while uTorrent runs on the host machine and its still more efficient than Az. When you can run an entire second OS in a much smaller footprint than a BT client then something is wrong. As I see it, people code in Java to save time/money. I expect that saving to be translated into the price. I'd also spend more on C/C++ equivalents quite happily.
Try chicken scheme. http://www.call-with-current-continuation.org/ most of what you want and an (IMHO) elegant language.
90% of the wealth is in 2% of the pockets. Bummer to be in the majority.
I really would like to see Iron Python work out :)
Religion is a gateway psychosis. -- Dave Foley
But, of course, then you are distorting the meaning of the statement. The original statement, as written, means "there is not a single ticket tracker written in Zope that is comparable to Eventum." When you change the language like you have, it now can be taken to mean "any ticket tracker written in Zope will not be as good as Eventum" -- which might be true, but is not what the parent was trying to say. The correct way to rephrase it would be:
And, as usual, the real lesson is that if you're going to be a self-righteous pedant, you should at least know what the fuck you're talking about, or else leave the English language to the professionals.
Okay, a more obvious example. Take the TI-85, the calculator I used in high school. Speed it up by a factor of a million. It doesn't get any more accurate, because it's still using the same number of bits to calculate. It doesn't magically gain the ability to solve problems that it couldn't before (unless the problem are time or memory-bound). The advantage to hardware improvements come from the ability to use the right algorithm, instead of hacks to bring in an answer in an acceptable amount of time.
So what happens when you run existing genetic algorithms or neural nets on a computer that's 1,000,000 times faster? I agree that running Word or Quake on a 1PHz computer would be silly, but protein folding or QCD is not. The algorithms already exist, it's just the problem size that is CPU/memory limited. Technically the algorithms may have scalability problems, but if you have a magical computer that's just a million times faster instead of having a million times more processors, the current algorithms will work just fine.
Despite what the VM fanboys like to spout, performance does still matter for a lot of applications.
What do we lose? Speed. Duh. You had to ask?
I've only identified one task they're good for so far.
If you're a professor who needs to present an application to students over the web for some purpose-- such as a simple physics equation simulator or some kind of calculator for instance, you can't assume that all your students are going to have PCs. So, by implementing something in Java it will run on PCs and Macs and most anything else...
I've seen a few of these, and they're usually pretty quirky but they apparently work on any platform. I've yet to encounter another need for that kind of platform independence, and I'm not a professor so I've not needed to do this, but it would appear to be about the only tool for the job so it is defacto also the best tool for the job.
On the other hand, No way would I buy a commercial package written in Java. A long time ago I realized that if you buy a computer, there are packages written expressly for your machine, and there are "ports" which are written to run on a variety of machines. Generally, the native packages perform far better and are not afraid to take full advantage of the special features of the hardware which is why I chose the machine in the first place. Now there are exceptions, I've seen packages that come in both Mac and PC versions that both seem to be well done (and largely native-coded too, BTW), that are worth buying. But I've yet to see a Java program that is anywhere near the quality or performance of a Photoshop, or a Maya or even a Star Office or a first-person shootemup or flight simulator. Is there anyone actively working on such products in Java? Or even in .NET managed code? Wake me up when there are, and then ask me if I'd buy such a package...
Come on, 3D graphics have been around a lot longer than 15 years. OpenGL itself is almost 15. Even a 286 PC could render 3D (fixed point or on a 287), it's only linear algebra, it just wouldn't look as pretty or be as fast on that old hardware, but the math is the same and you can do it in assembler just the same.
And no, the compiler is not "smarter" than a properly educated assembler programmer who understands the problem domain. The compiler is better than a poor assembler programmer, sure, and probably even an average one, but it will not beat a well thought out, hand tuned assembler program.
Slashdot is proof that Sturgeon's Law applies to mankind.
For those who haven't seen it, Panda3D is a game engine with a Python interface. It is the system underpinning Disney's Toontown MMO game for kids (IE required, because the website needs ActiveX). Panda3D is a full-featured game engine for Windows and Linux (with an unstable port to OS X; the Windows release tends to lead the pack). It has support for graphics, sound, networking, UI, collisions, physics, AI, and the Cg-shader language for high-end graphics cards. On top of that, the developer gets the advantage of a built-in engine profiler (for ironing out those trouble spots), an object placement tool, and the regular reflection, auto-documentation, debugging features, and libraries of the Python language. It's also open-source.
We used Panda3D on a project and were able to go from scratch to a complete product in a matter of two months. I sincerely doubt we'd have had that kind of turnaround with almost any other language / engine combination. From the nifty things specific to Python (pickling, solid dynamic typing, interactive runtime mode, runtime mutable classes) to the simple things that you expect from any high-level language (strings as a type, as opposed to "bag of characters;" automatic memory management; exception objects), we used about every aspect of the system to keep our project on-time and on-budget. If we had chosen a system such as SDL / C++, I suspect that the memory management issues alone would have bogged us down terminally.
Personally, I think there are a couple of lessons to be learned from the Panda3D example:
So there's one programmer's experience with hig
Take care,
Mark
There is a solution...
I don't think it's true to describe Perl as an "interpreted language". Firstly because it's compiled, at run time before execution.
By that definition, almost no languages are interpreted. Perl/Python/Ruby/Lua, etc., are tranformed from text to an internal format: either a parse tree or bytecodes or a list of addresses (a.k.a. threaded code). Then that internal format is interpreted at runtime. None of these languages are compiled to machine code.
[Quote[
e ws&file=article&sid=98 to see the header "magic".
But C does provide about as little abstraction as one can expect from a language.
[/Quote]
Okay, but the c preprocessor allows you to do a lot of "magic." For example, this is a c program that compiles, even though it doesn't LOOK like a c program (I wrote it this morning just to show that a cgi in c doesn't have to be complicated):
#include "html.h"
title("this document was generated by a c cgi");
body("bgcolor='silver'");
b("Hello, world");
end;
It doesn't look like a c program, but it compiles just fine with gcc. Even someone who doesn't know html OR c can grok this in a few seconds.
Go to http://groupehudson.com/postnuke/index.php?name=N
Well, it's a case of which "unsafe" things you allow, I suppose. I don't personally think that direct memory manipulation through pointers and the like helps you if you're using a rich language, and you don't want to actually write something which manipulates memory as its primary function (like a garbage collector or whatever). Dynamic typing is a different matter though, particularly for Rapid Application Development. Another fun-looking language for the CLI is Boo, which is "Python-inspired", with (optional) stronger typing and more influence from CLI languages, rather than an actual dialect of Python, as IronPython is.
http://groupehudson.com/postnuke/index.php?name=N
Lets hope THIS url doesn't get b0rked by slashcode.
I agree. I hate Java...I'm also opinionated!! LOL. I am a C++ code for the most part. When forced to use a scripting language I have found that python is the easist to extend and embedd. It's all just a matter of opinion for sure, but I will say that once I was convinced to learn Python I did have to conceed that it was the most maintanable language simply because it doesn't allow 50 million way's to do something. Just my thoughts tho.
what?
Since when do standards bodies make for a higher quality specification? They exist as a political process to ensure a wider 'supported' specification & to ensure stakeholders get their say at the table.
The Java langauge spec is very well defined, and there's more than one reference implementation of a JVM available to study... which is why you tend to see a lot of separate codebase VMs for Java (Sun v. IBM v. BEA JRockit v. Aonix v. kaffe v. GCJ) and value added derivatives of Sun's implementation (HP has variants for Tru64, UX, OpenVMS, and NonStop, and some have OS-particular features). Compatibility wise, they broadly work well with minor issues -- see BEA's support matrix, for example.
-Stu
Which you will see is possible, once you get away from your preconceptions.
I knew this conversation would be full of misconceptions as soon as I saw that it classified non-native languages as "interpreted/JIT". Runtimes like Java and .NET have not been based on either interpreters or Just-In-Time compilers for almost a decade. They use dynamic compilers which optimize on the basis of what the program is actually doing. This is something that no C++ compiler can do. This kind of optimization can result in "interpreted" applications that are actually faster than native apps. Not always, of course — it depends on what kind of application you're running. But it does happen.
Also the notion that optimization is about producing the most efficient machine language possible has been obsolete since about the time they stopped using Z80s in PCs. Software applications nowadays are more than symbol crunchers: they consist of complicated I/O and network components, which have to work together for the app to run efficiently. And adding multicore processors to the mix does not reassert the importance of micro-optimization. Quite the opposite: a multicore application is a concurrent (what people used to call "multithreaded") application. Actually, concurrency has been important ever since processors got so painfully fast — but now that the Mhz wars have been replaced by the multicore wars, concurrency is 10 times as important. And the best native code compiler on the planet does nothing to help a concurrent program run better. Only a good concurrent runtime can do that.
When early releases of the Java runtime ran so slowly, everybody blamed the fact that it was based on a simple bytecode intpreter. That was certainly part of the problem, but there were many other parts. One of these was the fact that Java's concurrency API was absurdly primitive and inefficient. That's no longer the case. And with a modern, powerful concurrency API, the Java runtime can handle your umpteen-core systems as well as any native code runtime.
... Java was invented mostly to get around the memory safety problems of C and C++ ...
It was invented as an attempt to break Microsoft's hegemony. If it could be a good language too, that was OK.
--
phunctor
It's not my choice of a license; it's the program's author's. Besides, as I mentioned earlier and you conspicuously omitted in your reply, neither the compiler nor the binaries it creates work with my Linux-incompatible hardware.
I'm not arguing the obvious. Yes, native code is going to be faster, assuming same code quality. They will not be more than two orders of magnitude difference. If the difference is a factor of 200, chances are something is wrong. That's hardly "The nature of the beast".
I hate grammar Nazi's.
This is another fine example of an article, by a member of the Java community, which attempts to wrestle the Java language from its stereotype of being used in mostly CPU idle applications. The whole notion of moving completely towards interpreted language applications is laughable. Java has its place and uses; web applications, gui interfaces, and anything else that's sits idle 99% of the time. The argument that processors are fast enough to run all applications written entirely in an interpreted language follows the comment, "Who needs more that 640k of memory?" That's easy to answer, everybody that likes to push the performance envelope, write a deterministic application, benchmark their system to death, or tweak a system to the hilt for sh*ts and giggles. There are a lot of folks in this category. Embedded application engineers relying on deterministic behavior would be foolish to get in bed with Java. Sure Java can make it last longer, but we want a quickie this time. Sorry, no time for foreplay. Trying to get something to happen every 5 microseconds, such as a good portion of modern medical equipment, would be tough with Java garbage collection and etc. looming nearby. Have fun sorting that out. Sure it can be turned off but there are numerous Java related barriers preventing high performance deterministic behavior. Found a bug in the JVM? Ugh, try debugging that or worse try to get Sun to do it without a truckload full of cash. Writing a cutting edge game? Could you imagine a project manager asking engineers, how can we make this Java coded game run faster without impacting the schedule much? Oh..Oh..Oh...me! I can answer that! Try C/C++ with inline assembly where needed and throw out the Java code. He'd pass out. The Java versus C++ battles are as contrived as they can get. Why does the Java community pick on GCC and a limited set of code examples? Then they use Sun's flagship Java implementation against an open source compiler. That's like pitting Pee-Wee Herman against Mike Tyson. The simple reason is Java can't hang with a reasonably complex high performance application written in C/C++. A better route than trying to push Java bloat on the rest of the developer community would be to deep six Java all together and push for a standard C++ threading model (boost threads), network interfaces (many already exist), a windowing framework (give us something better than the FLTK), and etc. With these tools in hand code written in C++ can be compiled for a wide variety of platforms more easily. We get the speed, flexibility, multi-platform usage with the same code base, and most importantly we can say bye-bye to Java.
If I had to have a programmer code a not-so-trivial application for me, then...
I wouldn't trust him to do it properly if he had no experience with low-level languages, because it is my opinion that a good coder must understand what happens between his code and the hardware aswell as he should have some knowledge about optimization and mission-critical algorithms*.
I wouldn't pay him if he had no experience with high-level languages, because he'll end up using too much time coding and optimizing instead of planning and designing the application structure, management, etc.
Of course, if I needed a non-mission-critical GUI-app to be coded within a short timeframe, I certainly wouldn't ask for a programmer with years of C-experience, but still the additional knowledge wouldn't hurt.
Once again, The-right-tool-for-the-right-job (tm) is the way to go.
Replacing most of the native code with interpreted one? Nah. You wouldn't want your database software/search engine/OS/compilers (calm down, just kidding) coded in a high-level language, would you?
IMO, low-level won't die, since there will always be need for mission-critical programs... and there's still something the high-level code needs to run on.
*Yes, these are necessary. How many search- and sort-algorithms do you know and know how to code? How many modern applications can do without? How many of those algorithms can be, of course after some optimization, executed in C (or Assembler if you really need those cycles...) much faster than in any high-level language?
FACT: .Net bytecode can be compiled when the program is installed.
No, I will not work for your startup
FYI, we do know the answer to that question.
An average PC nowadays holds enough power
No, a PC will never hold enough power, period. There always will be something that will need all of its power and more, therefore ASM will always be used for some tasks that need to be highly optimized.
You just got troll'd!
Riiiight.It makes me want to chop off all my fingers and file for disability every time I have to type something like that, which is quite often. Granted it's all C++'s fault -- STL sucks, but it sucks about as little as possible given the constraints that C++ places on it.
So? Its explicit. Its clean. And if you want to save typing, use typedefs.
(well, just about - I don't think you can use the top-of-screen menu bar in Swing apps)
:)
System.setProperty("apple.laf.useScreenMenuBar", "true");
Without looking at the documentation, I am not sure if this works with J2SE 5, but for 1.4.x Swing apps it works nicely.
Arr! The laws of physics be a harsh mistress!
I have experimented with Python, and Python is great. But it lacks an intrinsic array type, and arrays are as necessary as oxygen for numeric, audio signal processing, frame buffer graphics/image processing, and related work. Yes, there is NumArray and Numeric and NumPy, but a defined array type is a work in progress and there is far from universal adoption of any of them with frame buffer packages. Python is compared with Lisp, and even Lisp came around to having an array type which I understand was well-implemented with slices and all of that, but the Python array situation remains a work in progress. Java on the other hand has an intrinsic array type -- arrays are objects, but they are special types of objects where iterating over the subelements is almost as fast as native code.
Matlab -- very popular in the scientific community for data visualization -- also has intrinsic array types and is highly interoperable with Java and interoperable between the Matlab and Java array types. While there is a movement to develop libraries to make Python a FOSS alternative to Matlab, Python and Matlab don't readily interoperate, and Python doesn't interoperate with Java unless you go the Jython route, which is almost a whole other language, or go with some JNI support packages from CPython that are not actively supported.
Java has the much maligned Swing, but the BufferedImage class and the Graphics.copyArea() method are pretty much direct replacements for CreateDIBSection (frame buffer support) and ScrollWindowEx() (scrolling) in Windows -- I don't see anything equivalent in wxPython or in .NET/Mono/C# apart from "unsafe code" for that matters.
So people tell me the browser, not Java is the platform. Great, I am going to have to figure out how to blast arrays to frame buffers in AJAX and get those images to scroll.
Maybe I am jumping on the Java bandwagon too early -- maybe there is this product/project for implementing scientific data visualization called Python on Steroids, Matlab only following sound software development principles, that is this really well integrated object framework for such apps that is just coming out. Don't know. What I do know is that everything has its product development cycle, and Windows flopped around as a toy for 10 years (Windows app: Dog slow! RAM hungry! I can do graphical apps with mouse selection in DOS (I actually went that route)! They are much faster! DOS games, data visualization, even word processors were much faster in DOS). Then Windows 95 came along. Java is about at the same depth into its development cycle.
Python? That too has a development cycle. Maybe in a couple years it will have the features I want. Maybe I should ignore Java and wait for Python to come around.
My point is that everything has its development cycle and it can take a long, long time for products to reach maturity. Java look and feel all wrong, load times too long? There was a time when Windows was a wart on top of DOS with all of those odd fonts that didn't look right on the low resolution monitors of the day, and you had to run Windows first before you could run your Windows app.
Java, like pre-Windows 95, is a wart on top of the OS that seems foreign to the native OS, but it is a wart that runs on top of multiple OS's. Windows was an abstraction of the underlying PC, and oh the complaints about resource usage, slowness, and loss of access to the hardware and especially the graphics frame buffer. Windows fixed that with a combination of Moore's Law and the WinG initiative and later DirectX to
a difference of 200 is certainly less than 3 orders of magnitude difference, so its not THAT far outside your 2 orders of magnitude expectations.
There was nothing wrong. If you had written assembly/assembler/whatever you want to call it 15 years ago, you would know that the difference was often a couple of orders of magnitude. Heck, I wrote one routine just to spool data off of hard disks, and in assembler the disk transfer rate was twice the official rate on the drive. Surprising, but not that surprising. Custom routines tailored to the hardware are always going to yield better results.
Listen up pilgrim, we have the right to call ourselves Americans because everyone on our continent wants to be one!
This is my sig.
The early Java GUI tools were a well-thought-out abomination that sent droves and droves of developers in search of better solutions.
Netcode Constructor looked promising, but then Netscape bought them and it disappeared.
September 2011: Looking for Cocoa/iOS work in Boston area Cocoa Programmer Quincy, MA
Fortunately, tools to hide source code for trully interpreted (dynamic) languages also exist (here is a sample catalogue of JavaScript, Perl and VBScript obfuscators), though sometimes they require adaptation of source code.
Thanks very much. Hopefully someone will mod your post informative.
Now I know it's actually a case of people not bothering, rather than it being technically difficult.
Or to be closer to my original point - it's the philosophical rather than technical differences that make cross-platform GUI hard.
'Capitalists of the world, unite! Oh
Hmmm. There was a publically released formal spec for Java unlike the other languages. I agree that a formal spec is not the same as a working release. But neither is it a fragmentary prototype or something like that. You can actually start teaching yourself the language if you have a spec and think it is reasonably firm.
I don't know exactly when the spec became available, but I know I reviewed it intensively in 1992 or 1993 before deciding that the proposed data structure for the IL was going to be an ungodly mess -- bad enough that I'd pass on devoting a year or two preparing for a Java wave that might never materialize. I was told later that the data structure laid out in that spec was not, in fact, the way that data actually ended up being represented. I'm not sure where I got that 1990 date from, but I did look it up and the sources looked credible. Trying again, I find a lot of dates, for the beginning of Java mostly around 1991.
I'll plead guilty to comparing oranges to tangerines.
You can't see ANYTHING from a car, You've got to get out of the goddamned contraption and walk...Edward Abbey
So, as http://en.wikipedia.org/wiki/MMX says, MMX was the first SIMD extension to x86. People were not abusing the FPU - MMX instructions were present in every processor that was SIMD-capable.
The fact MMX shared the FPU registers in a different way does not make pre-MMX CPUs SIMD-capable.
http://www.dieblinkenlights.com
Why can't we have interpreters for compiled code, and compilers for interpreted?
That is to say, when I'm developing and/or debugging, I'd much rather be running my C/C++ code through some form of interpreter, and watching/debugging as events occur. No mysterious segmentation faults, no inserting a gazillion "printf('Works at line X'); ", statements to find that one screwed up line or even character.
By the same token, I'd love to have more interpreted languages happily compile. Perhaps it could boost the speed a bit, and sometimes it would make the packaging a bit more convenient. Also useful when there are things in one's code you just don't want visible (even though I am a fan of open-source, some security/etc routines are best left safe from the unwashed masses). Between the two, neither one is better than the other, but there's no reason we shouldn't be able to enjoy the best of both worlds.
People were using the fpu to do single-instruction multiple data (SIMD) before MMX. MMX meant that they no longer had to pack and unpack the values.
So, no, MMX was NOT the first use of SIMD. It just made the process easier.
Even though the JIT and interpreted languages are (nearly) as fast as native code in execution, in practive they are not. Languages like C# and Java make it very easy to create many wastfull objects. In C/C++ you don't have convinence of a garbage collector to clean up your mess. In C/C++ you have to keep strict record keeping of all of the objects, and as a result objects get reused more often.
I have found that C#/Java software runs slower only because the coding style does not enforce object reuse.
Fast Federal Court and I.T.C. updates
From recent actions by Microsoft, it appears that Microsoft's goal is to make native code unsuitable. It is very likely that NT 7.0 will not run native code unless it is digitally signed (or it is so sandboxed that it doesn't matter).
It is impossible to hack DRM when you can't run native code, and that's probably what it's all about.
Melissa
"Screw Sun, cross-platform will never work. Let's move on and steal the Java language." - Visual J++ Product Manager