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?"
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.
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.
> 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.
hmm, the warehouse I work on has multiple databases with billions of rows in them, can hit insert rates of 100,000 rows a second, can experience 60,000 queries/hour - many of which are trending data over 13 months, has hundreds of users. Many of these users are allowed to directly hit some of the databases with whatever query tool they want. Scans of a hundred million rows at a time aren't uncommon (though seldom happen more than a few dozen times a day).
This app is completely written in korn shell, python, php and sql (db2). Looks like Ruby is also coming into the picture now, will probably supplant much of the php in order to improve manageablity.
Oh yeah, and the frequency of releases is quick and it's defect rate is low. And we're planning to begin adding over 400 million events a day soon. I've done similar projects in C and java. Never anywhere near as successfully as in python and php.
We might consider rewriting a few select python classes in c. Maybe, if we port the ETL over to the Power5 architecture with psycho doesn't run. Otherwise, it's cheaper to just buy more hardware at this point - since each ETL server can handle about 3 billion rows of data/day with our python programs.
If you mean a compiler that takes simple linear code and magically makes it run faster on a massively parallel architecture, I'd be very interested in an argument for how that's even logically possible.
It's done by changing the paradigm. Stream programming, for one? You don't "magically" take linear code and make it fast. You get rid of "linear code". Linear code goes the way of the goto instruction... Very little of the computational heavy lifting is truely and unavoidably "linear".
I think you guys are missing the original poster's point. I think he is using the standard "right tool for the right job" line. He is saying that the db system shouldn't be an interpreted language since performance is very important there. That is the one system you probably wouldn't want to be in PHP. (Disclaimer: I'm just clarifying what I guess to be their point.)
BTW: I use Perl with Postgres, and yes, I wouldn't want Postgres to be wrote in Perl or PHP. I do, however, love using Perl for most everything else.
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.
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.
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 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
This is a recent adaptation of the 1946 article "Meihem in ce Klasrum" by Dolton Edwards published in Astounding Science Fiction (and, on the internet, usually incorrectly attributed to Mark Twain, like a great many other humorous things whose origin most people are uncertain of).
p hp#meihem for some historical versions.
See http://www.spellingsociety.org/news/media/spoofs.