- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
[quote user=xtremezone]The byte-code needs to be interpreted in order to be JIT compiled. ;) Unless the JVM just waves a magic wand? o_O It's obviously much faster than interpreting source code, but it still requires that interpretation step.[/quote]
What a tool. You don't even know an interpreter is.
Admin
Admin
Well, JIT-ed bytecode needs to be interpreted in order to be compiled in the sense that it needs to be "understood" and processed. But in that sense, C and assembly need to be "interpreted" too. In the more specific sense of "interpreted" we use in talking about program execution, an interpreter performs the instructions specified by the program. A JIT doesn't involve that kind of interpretation; if it did, a JIT would run the program while interpreting it, and then run the compiled version; but, obviously, a JIT doesn't require that you run every program twice.
Admin
Anyway, the difference is that a C/C++ program is "interpreted" and compiled once whereas Java byte-code is (AFAIK) interpreted and JIT compiled every time you run the program (on top of the original time by the developer). There's a performance penalty there at run-time, whereas for a C/C++ program, for example, that penalty is felt by the developers building it; usually not the end-user, and even if it is the end-user, it's a one time expense.
Admin
You're wrong, there is no interpreter. The terminology for what an interpreter is has been consistent for the best part of half a century. Interpreted programs are executed as the source - normally textual but also including other forms - is loaded. That's what an interpreter does: you wishing it was something else, so you could avoid being wrong, won't make it so.
Java byte-code is not interpreted. Beyond that there are a number of compilers that will render Java down to native executables - but nobody uses them because ... Java performance is indistinguishable from ASM/C/C++ performance in most cases because most applications involve much slower technologies such as disks, networks and databases; CPU and/or memory limitations are only the bottlenecks in a sub-set of applications, a subset that is shrinking every year.
Admin
What a bunch of tripe. It's motherfucking idiots like you that give programmers a bad name.
Admin
I too started programming in the early eighties. The only times I hung/crashed the first platform I really learned, I was POKEing around haphazardly. But, then the C64 had no protected memory, so that was kind of a hardware problem. Later on, I got access to Unix boxes and mainframes, and they were all rock-solid. Despite the fact I was then programming in C - the highly dangerous language you're complaining about - I never crashed the system on those. Out of hundreds of students sharing those systems, we generally only had one student-triggered OS crash per year.
The system instability you're complaining about is more appropriately attributed to Microsoft, for the most part. While they've mostly fixed their stability issues, they're still causing problems in other areas. According to court records, they've intentionally created platform incompatibilities for the specific purpose of having platform incompatibilities. That's the whole origin of C#, if I'm not mistaken.
Back in the beginning of this decade, I was maintaining an application which was performing poorly. I estimated to management that fixing the problem would take about 3 months of my time. They chose to upgrade the hardware, doubling the server cluster size, as it was cheaper. A year later, the workload had increased, and the system was again having performance problems. They quadrupled the size of the hardware - we had a fairly decent size server farm of Solaris boxes, so that was definitely more expensive, but they felt my time was better spent on other areas. Two years later, the hardware cost for upgrading to meet the expected needs of the next two years was over $1,000,000 US, and they approved my time to fix the application.
In two months (I'd had time to think about the exact implementation), I'd fixed the application performance issues, reducing the program run time from O(n^2) to O(nlogn), and thus decreased the load to the point where the original hardware would have still had enough capacity - despite the fact that two of those old servers had since died. (We didn't throw out the old hardware; we repurposed it.)
Scalability is still very important on the backend, as doubling the server size every time your 'n' increases by one is a losing game - eventually, the cost to double your server is prohibitive.
Admin
Agreed. Although, to be honest, I consider NetBeans to be one of the slow java apps I deal with. Sure, it can generally keep up with my typing and flipping between windows and stuff just fine. However, these are me bound, and as such, the last computer/software combo I've used which couldn't handle that was a Commodore 64 running GEOS. But when you get to things like performing CVS operations on the whole project, setting up the project, running tests, and especially starting up, it's crap. Give me vim and a command-line any day - vim's esoteric, but I've learned it already.
We seem to forget this far too much around here.
If you only have one 'stupid developer', and you have at least one other developer, fire your 'stupid developer'. He will do more damage in any language than his pay is worth.
Of course, before one does this, it's probably worthwhile to do some checking on the amount of time the rest of the team spends fixing, kludging, or working around problems the 'stupid developer' creates, and just how productive the 'stupid developer' is. I've seen people who were described as "stupid developer"s have an effective work index, relative to the average group member, anywhere from about -20 hours/day to 12 hours/day. While you clearly want to get rid of the left end of that range, you also clearly want to keep the right end. However, you might want to send said developer to code legibility training...
(The preceding paragraph depends upon having an accurate method to measure it. This can be very difficult; we only managed to measure the worst case scenario after we got rid of the guy - but it was pretty clear he was an issue. Since then we learned a bit, but it's still never easy.)
Admin
WTFlyingF? Historically, I've seen a lot more dedicated-purpose Windows boxes than I have dedicated-purpose Unix boxes - despite the fact I'm a Unix admin, not a Windows admin.
In any event, I typically find that either system allocates new memory much quicker than it swaps in old memory. I also find the free-pool reuse capabilities of every program I've encountered to be pathetic - I believe this is inherently true, but I do not have a proof for it.
So, if you can guarantee that a program will entirely fit within memory, and there won't be other large-memory programs competing with it, you may get better performance without worrying about memory usage. That having been said, I've seen a lot of large-memory algorithms which like to move their large data pools around, and this fundamentally scales horribly.
For example, I've seen quite a few programs which read in an entire file into memory - say, for example, a 2M file. They then process the first line of the file, and then shift the rest of the file forward in memory, to clear off the first line. Repeat. If one rewrote the algorithm to read in a single line at a time, so it didn't have to shift the memory, assuming that the file is not just two lines long, it'll run faster. If the lines average less than 160 characters, it'll run a lot faster. Note that the programs that behave as I've described here are generally written in pointer-free languages, so they can't just simply shift the char pointer forward.
Admin
We've had exactly one case where an application behaved slightly differently between Windows and Solaris, and this was when we were load-testing a web service proxy/auditing tool that I'd written. We're still not clear whether it was a bug in the JVM, or a setting in the operating system. For the rest, there have been no cases of applications not working on another platform, other than silly mistakes like hard-coded paths or path separators.
Begging your pardon, but what sort of frameworks are we talking about that will easily take an application that uses databases from, say, Windows to Linux? Let alone graphical applications; I've tried getting Qt applications to work on Solaris, and given up.If you just do standard I/O and maybe CGI, you can write code that easily compiles on both Windows and Unix. Many years ago, I've written a PHP-like interpreter that did just that. But as soon as you want to do more (say, network sockets), you're out of luck.
'Hopefully' indeed. But would you say that using a toolkit like Qt (because otherwise you'd have to totally rewrite your user interface code) is much more user-friendly than a Swing application? That's a novel way of looking at things. Hang on a second. You write applications that run in the CLR, and you are complaining about the JVM? WTF are you on about then? Happy happy that you can spend 'six months on an application' so it may run a bit faster, but in reality you're writing contact forms on web sites?Oh my (insert favourite deity here).
A Dell D620 laptop, with a T2300 Core Duo (not Core 2 Duo) CPU running at 1.66 GHz, and 2 GB of RAM, driving a screen in 1680x1050 resolution. From all the comments I've seen on this site, this must be a contender for the most uninformed one. It used to be common knowledge that the sun revolved around earth, and that you tell somebody's character from the shape of his head.'It is common knowledge' doesn't cut it. You'll have to come up with something better.
But I've never said that Java would be the solution for everything, and it obviously isn't. However, you, on the other hand, have pretty much claimed that Java is useless, purely based on the speed argument.And even that I have my sincere doubts about. You've looked at old versions of Netbeans, you've written code in college on even older Java versions... things have moved ahead over the years.
I was pretty sceptical about Java, too, after my first experiences. But then I wrote my first application (using EJB, Java WebStart, Swing and what else), and I've never looked back since. It allows me to write better code.
In which case, your argument about running time being more important than development time can pretty well be chucked in the rubbish bin, because the company you work for will have to make a profit, just like everybody else. It gets the job done, and with less hassle than everything else I've tried. If it has to be big, multi-tiered, interfacing with a lot of systems, Java is (for me at least) the way to go. If it is simple and can be done quickly, I use Perl. And if I need to decode a binary file such as BER, I use C. It just so happens that most things I do involve talking to databases and multiple systems, and Java is just very good at that. Somebody made the choice for Java, though. Given that it would run the public transport for an entire country, we're probably talking about a lot of nodes (in which case Windows boxes would mean a lot of licences), a lot of inter-node communications, interfacing with legacy systems, and a lot of databases. These are all things that Java is very good at. All the things it needs to be doing are limited by network and database speeds.But given that you've probably never written an application that is seriously big, or constitutes an infrastructure, you probably cannot appreciate the advantages that a platform like Java (rather than a language like C++) has to offer under these circumstances.
Admin
What a dick.
Admin
Beej's Guide To Network Programming (arguably the best socket guide available on the Web) has a section explaining the minor differences.
GUI programming is surely one place where things get much more complicated to port (hell, even just writing a GUI application for a single platform can be a pain), but unfortunately some of those applications are the ones that benefit most from being native builds because workstation users like to use many of them all at the same time for extended periods of time (the exception being short utility programs which are fine written in interpreted or JIT compiled languages because you probably only use it for a minute now and then anyway).
X Windows has been ported to Windows, but I don't have any experience writing X software so I can't say what the porting concerns are. Obviously it's nice to keep a native look/feel, but that's something that Java frameworks don't seem to like to do by default anyway.
I didn't get to choose the technology. :P In my experience, though, .NET applications (on Windows, at least) perform better than Java applications (though you must have missed it earlier where I said that ASP.NET has been performing poorly IMHO, so either we're doing something wrong or it suffers the same problems, even on Windows). You are correct. Maybe when I do my appreciation will change. :P Maybe not. Speed is really only one of my problems with Java. I'm also not a fan of the language (probably just because I'm too used to C/C++, and they are quite different) and I'm also not a fan of Java formatting styles, which makes pretty much any code not written by me illegible (which can honestly be said for most languages, as most people don't care too much about style, but I digress...).Admin
Admin
Mucking around with the preprocessor to solve this is probably the worst solution you could possibly come up with. Just hide the WINSOCK/Berkely sockets API underneath a wrapper and have that wrapper call either the Windows or the UNIX variant of the function based on whether you're compiling on Windows or UNIX. In C++, the preprocessor is best left alone unless there's a very good reason to use it.
Admin
Admin
Admin
Admin
No, tabs are the only correct way to indent. Let the space fools rot in hell. :p
Admin
The only problem with tabs is that they don't line up well with single-space character data. Therefore, tabs are best for indentation, but spaces are best for lining things up.
For example, with [--] representing a tab character and spaces representing spaces, this is how func1 and func2 from the above code would be intended:
That should look right no matter how you have tabs configured in your editor.
I find that using spaces for indentation makes me crazy. I never know when I'm going to skip one character or 4 and need to pay extra attention and it slows me down. Tabs are also better supported (you might not be able to configure how many spaces wide they are, but they'll work in pretty much any text editor whereas spaces require a ton of extra typing in editors that don't support smart indentation).
Admin
That being said, the above remark may not have been made in absolute earnest.
Admin
Admin
Admin
I code in Python quite a bit, and tabs for indenting work JUST FINE in Python. :)
Admin
Advising against the use of tabs for indenting on the grounds that you might end up mixing them with spaces is akin to advising against the use of pointers because you might end up trying to dereference a null pointer.
Anyone who mixes spaces and tabs is a fool. Use tabs the RIGHT WAY (i.e. tabs to indent, spaces to align ... if you absolutely must align things), and tabs beat spaces hands down because that way you're not forcing your personal tab-width preference on everybody else.
The fact that some crappy editors do not handle tabs correctly is NOT a reason to be a space-indenting fascist scumbag. :P
Admin
Admin
That is odd because memory allocation and deallocation is 5-10 times faster than C or C++ and a good chunk of nearly any programs execution time is spent in these two tasks.
Admin
[quote] I'm not sure where you would want to pass by value in Java... [/bold]
Are you serious?
Java uses pass by value and only pass by value.
What Java call references are nothing more than implicit pointers, and once more, they are only passed by value.
The ignorance on this thread is astounding.
Admin
Only if the object is mutable! Geez, it is always jackasses without the first clue about Java that rail against it.
Admin
Java threads do not fork processes.
Admin
You are funny, I guess you didn't know that memory allocation and deallocation is considerably faster in Java.
There are many java programs that beat the living snot out of C and C++, and vice versa. Your ignorance does not change that.
Admin
You must not know Python. Mixing spaces and tabs will cause your program to crash. Whitespace matters a lot in Python.
Admin
If you think javas slow or hard to maintain, it means your not competent in it.
Admin
Забота о недвижимости - это забота о спокойствии. Утепление наружных стен - это не только стильный внешний вид, но и обеспечение тепла в вашем удобном уголке. Наша бригада, группа специалистов, предлагаем вам переделать ваш дом в идеальное жилище. Наши дизайнерские решения - это не просто утепление, это творческий процесс с каждым строительны
Admin
thanks for info
Addendum 2024-08-12 03:40: Navigating the vast array of casinos and slot games in Australia can be overwhelming, but website simplifies the process with its well-organized listings. This site offers a thorough guide to the best casinos across the country, including their most engaging slot games. From high-stakes tables to casual play, the site covers all types of gaming preferences and provides valuable information about bonuses and promotions. If you're looking for a reliable resource to help you discover premier gambling options, this site is definitely worth checking out.