Slashdot Mirror


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?"

53 of 1,173 comments (clear)

  1. Have you tried coding anything hard? by Anonymous Coward · · Score: 4, Insightful

    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.

    1. Re:Have you tried coding anything hard? by Hamled · · Score: 2, Insightful

      The blinking lights, obviously!

      But seriously, I like the Python model of "code the performance intensive parts in lower-level languages, code the rest in higher level languages that control it." If using an interpreted language would afford you more flexibility, more powerful language constructs, and faster development times, without much negative impact on parts of your system that are not performance-critical, it's almost a no-brainer to use them for those areas.

    2. Re:Have you tried coding anything hard? by Fulcrum+of+Evil · · Score: 3, Insightful

      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

      cans of a hundred million rows at a time aren't uncommon (though seldom happen more than a few dozen times a day).

      Yes they are. Go read what you wrote.

      This app is completely written in korn shell, python, php and sql (db2).

      One guess where 99% of the ccycles arae in that (and 90% of the dollars).

      --
      "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
    3. Re:Have you tried coding anything hard? by teknomage1 · · Score: 3, Insightful

      I suspect you've missed the point. The database (db2) is doing most of the work and is indeed written in native code. The interface logic most certainly is appropriate to be highe level, but the database engine itself is probably better off as native code. Ditto for the operating system kernel.

      --
      Stop intellectual property from infringing on me
  2. Its inevitable by greywire · · Score: 4, Insightful

    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.
    1. Re:Its inevitable by lbrandy · · Score: 3, Insightful

      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).

      This cracks me up. As we head towards multi-core and massively-multi-core, you are telling me that things are going to get better for interprative languages? Compilers are about to kicked in the pants because we can only do thread-level-parallelism for so long (uh, lets say N=4.. when do those quad-cores come out? Early 07?).... The trend towards parallelism is going make compilers infinitely more importants as (memory bandwidth + computation bandwidth) gets the additions of a new, third term... communication bandwidth. It's just one more thing compilers are going to have to learn to deal with... and interpretative languages are going to fall farther behind... not catch up.

      There will come day where we expect our compilers to encode parallel information into the code so it will run faster on our 1024 core machines. Interprative languages are going to be struggling to do that "just-in-time" like they struggle to do any optimizations now "just-in-time".

    2. Re:Its inevitable by David+Greene · · Score: 3, Insightful
      There will come day where we expect our compilers to encode parallel information into the code so it will run faster on our 1024 core machines.
      Too late. That day has been around for 20 years already.
      --

    3. Re:Its inevitable by evought · · Score: 5, Insightful

      Your argument actually points out how much *more* valuable interpreted and JIT languages will get. Are you going to compile new binaries for every architecture and combination of cores? Or, are you going to encode the logic of the application and have your JIT figure out how to optimize for the specific platform. Before you say that JITs cannot hack this, remember that they use exactly the same technology as your 'standard' compilers.

      Secondly, if it is a question of taking too long to compile, realize that you can always ship optimized binaries from high-level languages (e.g. GCJ), but you cannot readily make your optimized native code work on a new platform.

    4. Re:Its inevitable by Lost+Engineer · · Score: 2, Insightful

      Your link is a bit vague for me. I have used a Cray cluster lately, and I was forced to handle parallelism on my own, using MPI, UPC and like paradigms. What parallelism do Cray compilers handle automatically?

    5. Re:Its inevitable by cryptoluddite · · Score: 4, Insightful

      I actually have a dual-core machine at work and the only single program I have ever seen use more than one CPU at a time was written in Java. Even the single-threaded Java programs use like 110% CPU as the garbage collector (or whatever) runs in parallel (this was the genome benchmark from language shootout iirc). As in, "cpu time 110s, wall clock time 100s". Java is already ahead on multi-core.

      Basically you are smoking crack thinking that compiled languages are going to thrive on multi-core. They aren't. Hell it's hard enough to keep data access correct with just a single thread. And with a "safe" language like Java the compile *knows* there are no aliases for an array, so some kinds of access can automatically be done in parallel, whereas in a separately compiled/linked language like C there are few ways for the compiler to know this. When there's not enough active threads per core the other core's can GC the inactive programs. Safe languages have huge advantages on multi-core.

  3. two things by bunions · · Score: 4, Insightful

    (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.
    1. Re:two things by sl3xd · · Score: 5, Insightful

      You forgot high performance computing (ie supercomputing) environments, where electrical costs are measured in dollars per minute (and the job takes weeks).

      There are plenty of cases where it is far more cost effective to pay somebody $10k/week to optimize the hell out of a piece of code, because a 1% optimization will save thousands of dollars over the course of a year. The market for supercomputing applications is growing substantially. It's quite frequently cheaper to prototype in a supercomputer than it is to do something 'in the real world.'

      I always laugh when I see people point out benchmarks where Java is compared to C in terms of the Linpack benchmark -- entirely ignoring the fact that in both cases, the actual 'work' is being done in neither Java nor C, but in a BLAS library that is written in Fortran. It's hardly suprising they have similar speeds -- they're running the exact same routines, from the exact same Fortran library.

      The thing I see is this: The market for interpreted languages is fairly static -- I remember playing simple games written in BASIC on my parent's Apple II. I recall word processors, education software, etc -- all written in interpreted languages.

      The region of 'corner cases' where native-compiled code is substantially faster than interpreted languages hasn't changed significantly over my lifetime. High performance games were, are, and will remain native-compiled code for the forseeable future. The same applies to supercomputing. Embedded machines are also a bastion of native code -- simply because they are produced on a scale that favors code written natively-- the tradeoff being more expensive hardware, and the economics never work out such that software (including its one-time development cost) is cheaper than hardware.

      There's nothing wrong with either; they are tools, to be used appropriately. Being a rabid fanboy (or hater) of either only proves one is willfully ignorant of reality. Fifteen years ago, an interpreted language kept many of the world's largest mainframes running -- it wasn't Java, it was BASIC (or one of quite a few other interpreted languages).

      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.

      Don't think for a second that interpreted languages are taking over; or that they're losing ground. The more things change, the more they stay the same.

      --
      -- Sometimes you have to turn the lights off in order to see.
    2. Re:two things by Anonymous Coward · · Score: 1, Insightful

      Wow - great reply and excellent way to sum things up. I suspect you and I both have probably been in this general area of work (IT and related) for quite a bit longer than the avg. reader of this forum...

      Several years ago, my motto became "the more things change, the more they stay the same" when speaking of "new" computing trends. It never fails to amaze me how history seems to repeat itself in this business - the difference being that in IT and related, the trends of 'bygone days' repeat in internet time compared to other endeavors (as in, the cycles seem to happen every decade or so).

      One thing you can really count on with regards to general trends in IT, is that we've almost certainly been through similiar before (on a macro level), and the only thing that has really changed is the specifics.

      As an aside, roughly 15 years ago I can recall an MS engineer predicting that interpreted VB Pcode would soon match or exceed compiled code in many areas, especially because of how the interpreter had runtime information and could take advantage of things like multi-threading and CPU pipelines running in parallel, etc. Sound vaguely familiar?? Now of course, it's JIT, multi-core, etc., etc... None of this stuff is really new - JIT's, multi-core and the like have all been around for years now, really, they just happen to be the mainstream trend (right now).

  4. Why isn't anything compiled natively anymore? by Crussy · · Score: 3, Insightful

    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.

  5. Someone's been reading too many benchmarks by Xugumad · · Score: 4, Insightful
    "Regardless of the negligible performance hit compared to native code"

    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:

    • This is not Java vs C++. This is Sun's JDK 1.4.2 vs GCC 3.3.1 on a P4 mobile processor.
    • GCC is not a fast compiler, it's a portable compiler that happens to be fairly fast. A fast compiler might be something like Intel's own compiler: http://www.linuxjournal.com/article/4885
    • Having proven that method calls take almost twice as long under G++: http://kano.net/javabench/graph - the author then several of the tests recursively ( http://kano.net/javabench/src/cpp/fibo.cpp ). When this benchmark came out, various people on /. managed to get around 1,000 times better perfomance (under G++) by switching to a fixed memory usage non-recursive implementation.


    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.


    Y'know, I think there's a reason for that...

    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).


    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...
    1. Re:Someone's been reading too many benchmarks by IamTheRealMike · · Score: 2, Insightful
      This really isn't correct. Modern optimizing compilers can do some very powerful and very expensive kinds of optimisation. The kind that double your compile time, at least, but can be worth it - one developer working on a console game claimed that when whole-program optimization was enabled in the newest MSVC++ they got "a ridiculous 30% speedup", for free (his words not mine). 30% sounds remarkably high but it's not impossible in a closed system like a games console game, in which (say) dynamic loading of code is impossible.

      Java has several extremely poor design decisions that render it difficult to optimise compared to ahead-of-time compiled static languages like C++:

      • The javac "compiler" does practically no optimization at all. It leaves it all to the JVM. Therefore the end user pays the overhead of the compiler instead of the developer.

      • Java code can dynamically load other Java code at any point, and there's no way to indicate you'd like this disabled (the std lib does it all over the place anyway). This fact alone prevents many useful whole program optimisations such as call-site optimisation .... say you can prove that a particular method call will always dispatch to a given class (because the variable is typed to be that class and it has no subclasses). A good optimising compiler will replace the virtual method call dispatch with a direct call, saving on a possible pipeline stall and memory reference. No matter how fancy it gets, the JVM simply cannot do that, because at any point some new code may be loaded which subclasses that original class, invalidating the optimisation.

      • The language is designed to be minimalist with no way to extend it. Look at how many attributes GCC supports that are optimisation related to get a feel for this disadvantage. The compiler-specific attributes combined with the pre-processor can not only improve correctness of code but give the compiler hints about the program that it can't easily figure out for itself yet. No equivalent in Java

      That said, whilst the best C++ compilers can still stomp all over the JVM, it's usually compared in benchmarks to GCC which has only recently started getting the more advanced optimisations developed in the last ten years or so. And by default you need to invoke GCC in certain magic ways to get them, which many developers don't know how to do. This gives Java a sort of built in advantage.

      For code where performance matters I just can't see how Java can ever win .... it fundamentally tries to compile "on the fly" which means only very trivial optimisations can be done, no matter how many hotspots you have. It's just not feasable for the JVM to spend half an hour pondering the structure of a complex program in the same way that it is for an AOT compiler.

  6. CPUs still have *A LOT* to evolve by mangu · · Score: 3, Insightful
    Interpreted languages have been OK for a long time, for applications where performance isn't the most important parameter.


    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.

    1. Re:CPUs still have *A LOT* to evolve by An+Onerous+Coward · · Score: 4, Insightful

      You seem to be under the impression that these problems you cite display inadequacies in the hardware, rather than the software. But, in the words of some fictional professor from a book I can't remember: "If you speed up a dog's brain by a factor of a million, you'll have a machine that takes only three nanoseconds to decide to sniff your crotch." Given the current software and algorithms available, more computing power alone wouldn't solve any of the problems you describe.

      --

      You want the truthiness? You can't handle the truthiness!

  7. Well, yes and no by BigCheese · · Score: 4, Insightful

    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
  8. Depends on the task by DigitalCrackPipe · · Score: 4, Insightful

    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.

  9. Re:On the subject of loosers... by Anonymous Coward · · Score: 1, Insightful

    > It's starting [to] annoy me as much as people [who] can't tell they're from there from their.

    I'm not from there. I'm sorry if it annoys you, but, really, I'm not.

    (You should probably put some quotes in there somewhere).

    It's usually USians who get these things wrong, of course. Those I've talked to really don't seem to care much and explain it away as "evolution of the language".

    I guess there's an argument there somewhere, but I look to history and find 'reports' of 'people' (iirc, Webster) deliberately changing the language - not out of ignorance, but just to piss off the English. It worked - and is still working.

    Just another example of 'Embrace and extend' - part of the US culture (is that an oxymoron?). The USA is the 'Microsoft' of the English language - copy it, then change it so that it doesn't work properly with the original version. ... and you lot complain about China.

    If I had the opportunity to change the language, I would make more obvious changes, like remove silent letters.

    Wow - you actually used 'correctly' correctly! Awesome! Obviously, you're not an Apple user, else you'd spell it different.

    BTW, for anyone who's interested, it's not "British English", it's just "English". The Scotts, Welsh and Irish each have their own language - some even use them.

  10. Embedded Platforms by Anonymous Coward · · Score: 2, Insightful

    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.

  11. Re:What?!?!? by Anonymous Coward · · Score: 2, Insightful

    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.

  12. It depends by Sloppy · · Score: 4, Insightful

    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.
  13. Re:What?!?!? by An+Onerous+Coward · · Score: 2, Insightful

    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!

  14. Re:What?!?!? by VGPowerlord · · Score: 2, Insightful

    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
  15. Analogies suck, but... by mangu · · Score: 3, Insightful
    the lower level languages just give me more of a feeling of actually creating something on the computer- as opposed to some runtime environment.


    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.

    1. Re:Analogies suck, but... by Abcd1234 · · Score: 4, Insightful

      but the results are incomparably better

      By what metric? Expressiveness? Ease of implementation? Ease of maintenance? Error rate? Because, last I checked, low-level languages like C fail on all those points compared to a higher-level language.

  16. Re:What?!?!? by tomhudson · · Score: 2, Insightful

    ... 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.

  17. The thing about modern computer performance by stevenm86 · · Score: 2, Insightful

    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.

  18. Re:-1 flamebait by Fulcrum+of+Evil · · Score: 2, Insightful

    Therefore, Lisp can't be used to create an operating system!

    Heh, I love it when kiddies try to do logic. Learn some history, damnit!
    --
    "We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
  19. Re:PHP vs ASP vs C++ vs JavaScript by NotQuiteReal · · Score: 2, Insightful
    But it will take you 4 times longer to write it in C++...

    So, the question is what is more important? Time to code or Time to run?

    If you have a one-off task, and your developer costs money, you want quick-to-develop.

    If you are going to run the program a bijillion times (a lot), you quick-to-run at whatever developer cost.

    I've coded C++, Java, and .NET services that all did what they needed to do (long running data collection applications).

    There is more than one way to skin a cat, and the end result all tastes good with enough hot sauce.

    --
    This issue is a bit more complicated than you think.
  20. The problem: our native-code languages are bad by Animats · · Score: 5, Insightful

    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.

    1. Re:The problem: our native-code languages are bad by Animats · · Score: 2, Insightful

      But the _real_ issue is that there are times: 1) when you want arrays and pointers to be the same thing, and 2) when you don't

      No, the real issue is that you can't talk about the size of variable-sized data in C.

      If C had syntax like

      int write(int fd, size_t length, char buf[length]);

      instead of

      int write(int fd, char* buf, size_t length);

      then size information would be carried along with the data, and checking would be possible. In the syntax we have now, you're lying to the compiler; you're saying you have a pointer to a char, but you really have a pointer to an array of char of indeterminate length. That's the problem. Most buffer overflows arise from this language design error.

      C++ tries to paper this over with collection classes, but raw pointers keep leaking out, and the hiding thus doesn't quite work.

  21. Bingo by Dr.+Zowie · · Score: 3, Insightful
    I do a lot of interactive data processing. I use PDL a variant of Perl (which, recall, is JIT-compiled) that is designed for array handling. For most of what I do PDL is great -- the CPU spends most of its time waiting for me to make up my mind what I want to do, and moving my ponderously slow fingers to type the command at 110 baud. But some of the stuff I do (magnetohydrodynamic simulation) is exremely CPU-bound, and that stuff I write in C.


    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.

  22. Getting lazy? by twazzock · · Score: 2, Insightful

    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?

  23. My one guess by xant · · Score: 5, Insightful


    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.
    1. Re:My one guess by nettdata · · Score: 3, Insightful

      Well said... too many people lose sight of the goal, and think that all eficiency boils down to CPU cycles.

      In reality, it is a compromise between many factors, including cost, flexibility, rate of change, manageability, and performance.

      The only REAL requirement is that it does its job at a cost that is reasonable and sustainable to the company.

      If you spend 10 times more on development and increase time to delivery in order to save a small fraction of that on hardware, you've lost.

      For what it's worth, we do ALL of our development in interpreted languages, mostly Java, some PHP, Ruby on Rails, etc., and it all comes down to whatever is the best tool for the job. Very rarely do we ever come across a situation where 2 clients have needs that result in the exact same tools being used, unless it's just to use tools that we're more familiar with so that we can get the job done faster for them.

      It's all about balancing compromise.

      --



      $0.02 (CDN)
  24. VMs have more information to make better choices by bwbadger · · Score: 2, Insightful

    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.

  25. Re:On the subject of loosers... by Bastard+of+Subhumani · · Score: 2, Insightful
    We've simplified superfluous pronunciations, as in aluminium ->aluminum
    If that's so, why didn't you do it for sodum, potassum, calcum & the rest?
    --
    Only three things are certain; death, taxes, and apocryphal quotations - Ben Franklin.
  26. The End of [Insert Something] by suv4x4 · · Score: 3, Insightful

    I'm sick of cliched sensationalist articles with the sensationalist titles, how about you?

    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 .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.

    So wait, we were talking about end of what again?

  27. Re:What else by petermgreen · · Score: 3, Insightful

    The point is, if you're going to be waiting 50ms for disk access, why bother shaving 2ms of processing time by running in a native compiled language? Nobody will ever notice.
    what they will notice is when the gc decides it needs to scan a memory area that has been swapped out crowding out any other IO on the system.

    Average performance only matters for a few time consuming tasks (and they do still exist), what matters far more in end user apps is any apparent hangs, if a button takes 100ms to get a response i probablly won't notice unless i'm gaming. if a button takes 10ms 99% of the time and 1 second the rest then i damn well will notice despite the better average performance, app startup time is also a killer in terms of percived perfomance (and languages like java are terrible for this especilly the first run on boot).

    And you may find the more modern and high-level design of the interpreted language's library allows you to write faster performing IO code more easily than the simple & low level libraries that are supplied with most compiled languages, at which point you may get better results for the same programming effort for using that language.
    java.io really sucks for some types of apps as it basically forces you to have one thread per socket and the new java.nio isn't really any higher level than bsd sockets. I don't know what the situation is like over in .net land though maybe its better there.

    --
    note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
  28. Re:Theres no such thing as "British English" by tolan-b · · Score: 1, Insightful

    No sorry, the English spoken in England is called 'English'. It is the language of the English.

    Americans speak an American version of English, hence 'American English'. And so on.

  29. you'll learn by m874t232 · · Score: 3, Insightful

    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.

  30. simple by m874t232 · · Score: 2, Insightful

    There are several reasons.

    (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 .NET have already far surpassed Java desktop usage on their respective platforms (and Mono makes both sets of APIs cross-platform if you want).

    (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 .NET is a better platform for developing Windows apps anyway.

    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.

  31. Article title should be: Java/C# vs C++ by zaphle · · Score: 2, Insightful

    - 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?
  32. In 1997 by lapagecp · · Score: 2, Insightful

    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.

  33. Philosophical reason why higher level is key by eyefish · · Score: 3, Insightful

    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.

  34. Re:On the subject of loosers... by cooley · · Score: 2, Insightful

    [i]It's "USians" to avoid using "Americans" to refer to 300 million people when there are legitimately over a billion people who can claim the name "American." [/i]

    Wouldn't that logic make the Scottish and the Welsh "British"?

    --
    Just then the floating disembodied head of Colonel Sanders started yelling Everything You Know Is Wrong!-Weird Al
  35. Scoping by Goblez · · Score: 2, Insightful

    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
  36. Swing/SWT and Open Source Java by beemishboy · · Score: 2, Insightful

    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.

  37. Re:Linguistic maturity by Anonymous Coward · · Score: 1, Insightful
    Why are ticket trackers written in zope not even 1/10th as good as eventum written in php?

    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:

    Why is it that not one ticket tracker written in Zope is 1/10th as good as Eventum, which is written in PHP?

    ...which, of course, isn't much different from the original "how come," except that it avoids the colloquialism. In so doing, however, it constrains the language to a prescriptive, whitewashed subsegment of its full vocabulary -- in other words, it's boring.

    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.

  38. Redundant, but... by bryonak · · Score: 2, Insightful

    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?