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 key advantage of using a JIT compiler to perform optimisation is that you can perform optimisations that only work under conditions that are not provably true, and then undo the optimisation if it later turns out to be false. In your example, the JVM could do that, as long as it ensures that if such a subclass is loaded the optimised method is invalidated and recompiled before next use. See the description of the Java HotSpot JIT here:
A new class may contain new methods that need to be inlined in the appropriate places. So the Java HotSpot performance engine must be able to dynamically deoptimize (and then reoptimize if necessary) previously optimized hot spots, even during the execution of the code for the hot spot. Without this capability, general inlining cannot be safely performed on Java technology-based programs.
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
Attributes were added to the language in version 1.5. You can now mark your classes and methods with arbitrary attributes, which individual compilers and runtime environments are free to interpret however they wish.
Re:LISP, BASIC, FORTH, P-Code, Java+Netscape
on
The End of Native Code?
·
· Score: 2, Informative
if zope is so great then how come there are only three or four blogs written for it and not one of them is 1/10th as good as wordpress which is written in PHP? How come not one ticket tracker written in zope is 1/10th as good as eventum written in php?
You might think you know the answer, but you're wrong. The real answer is very obvious. It is this: zope has a low installed base at ISPs. Perhaps this is because PHP is easier than Zope, I don't know. I suspect it's just because more people use PHP because more people have tried PHP, and that's because PHP is what *everyone* knows is what you use for writing simple web applications (either that or ASP). More complex apps? Java servlets, or ISAPI extensions. If you're a hacker? mod_perl.
This is common wisdom, so this is what people do. So this is what the ISPs support.
Seriously, that's the reason. I'm currently working on a major web application in PHP. Would I rather be doing it in Python? Sure; it's a much better language, much cleaner syntax, does everything I need it to more effeciently than PHP does. So why am I using PHP? Because I want portability between as many ISPs as I can feasibly arrange, and when I ask ISPs if they have Python/Apache mod_python installed, most of the ones in the price range I'm targetting say they don't. All of the ones in my price range can support PHP. About a third of them can support ASP.
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.
What few people seem to have realised is that the best way of achieving cross platform portability is not to throw out the systems you're porting to and implement everything from scratch (the AWT/SWING approach). This just results in applications that feel wrong whichever system you run them on. The answer is to use native widgets in a way that is flexible enough to allow the toolkit to decide look & feel issues rather than the programmer. Sure, it's a little harder to write for (you'll probably find yourself doing stuff like writing an XML definition of how the interface should work rather than directly manipulating controls, which is a little more abstract and maybe a little harder to work with if you're aiming for something other than trivial interactions), but the results are so much better that in most cases it's worth the tiny extra effort involved.
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.)
PHP gets messy past about 2000-5000 lines of code [...] no closures of course
As I'm currently working on a PHP project that's about to hit 8,000 lines of code and is showing no signs of stopping that upward climb in the near future, I understand most of your concerns. But none of them are killers.
You should be aware, BTW, that closures can be simulated quite easily in PHP, as they can in any dynamic language that supports 'eval' thus:
<?php
function makeclosure ($object, $method)
{
$name = uniqid ('closure');
$GLOBALS[$name . '_object'] = $object;
eval ('function ' . $name . ' () { global $' . $name . '_object; return $' . $name . '_object->' . $method . '(); }');
return $name;
}
class A
{
function b () { echo "A::b()\n"; }
};
$a = new A;
$c = makeclosure ($a, "b");
$c ();
?>
(I leave handling of function parameters as an exercise to the reader; it's fairly straightforward, but detracts from the readability of the example)
If your native code is running as slow as interpreted, I would really recommend getting that looked at.
The question you have to ask, of course, is where is the bottleneck. And the answer is fairly obvious if you analyse the performance of modern applications on a variety of different hardware: IO is the bottleneck in almost every case. There's no other explanation for why my 400MHz desktop (with a nice, fast hard disk) performs as well as or better than my 1.7GHz laptop (with a slow, energy saving hard disk but otherwise similar specs) for many applications (including Firefox, OpenOffice, etc... the kind of things that the average user runs daily) while the laptop wipes the floor with it for others (media players, SketchUp).
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. 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.
In the end, fast programs are about good design, not language choice. Higher level languages often allow you to spend more time on design and less on implementation. All real-world projects have a limited time scale; ISVs just try to do the best they can with the time they have available, which isn't usually producing something miraculous.
It takes a special kind of brilliance to write a debugger---one that I certainly will never have---and I admire him for doing such great and valuable work.
I'm not sure I follow you. In what way is a debugger harder than (say) a compiler?
Just a point of information: the French Prime Minister (Dominique de Villepin) is not a head of state. That position is reserved for the President (Jacques Chirac).
I developed a 32-bit protected mode operating system kernel with multitasking and memory protection on a 386 SX 40. 386 SXs can run 32 bit operations fine.
I guess Mr. Jamieson (if that is his real name..) forgot that other manufacturers could choose to offer non-drm'd.mp3 files which would work on the iPod, and any other mp3 player on the planet.
I think what he's aiming at is more the ability to download from iTMS and play on a non-apple device.
That's an... err... interesting article. I was right with them until they said:
"This experiment proved that electric batteries were used some 1,800 years before their modern invention by Alessandro Volta in 1799."
Err... no, it doesn't. At the most it proves that somebody made a battery in a 2,000 year old pot at some point during that pot's lifetime. I'm figuring it's more likely to be entirely coincidental, and there's nothing there that doesn't.
"Iraq has a rich national heritage. The Garden of Eden and the Tower of Babel are said to have been sited in this ancient land."
How about the Hanging Gardens of Babylon, which are at least widely acknowledged to have existed, as opposed to the two examples they cite which are probably purely mythological?
> Ok, you do REALIZE that a 386 processor is 32bit? The 386SX was designed for systems designers who were looking for 386 capabilities at 286 system prices. Like the 286, the 386SX is restricted to only 16 bits when communicating with other system components, such as memory. What part of 386sx did you not read in my orginal post?
The 386SX is internally identical to the 386DX. Programming it is identical. It has 32 bit registers and uses 32 bit addressing. It is a 32 bit processor.
It sits on a 16 bit bus. This is a hardware interface issue only. If this makes the 386SX a 16 bit processor, then the Pentium is a 64 bit processor.
You should have asked how I got Win95 running on a 386sx because the installer won't run.
By installing it on a DX and then switching the disk to another machine? Only stuff that specifically checks for an SX won't run on an SX. It might be embarassingly slow, but it'll run.
Because you might want your router to do something that that $30 hardware router (and where do you get one that cheap, BTW?) can't.
For example, mine currently:
* Has a store & forward SMTP daemon that scans my incoming mail for viruses and junk before forwarding it to my main SMTP server. * Runs a web request sanitiser that forwards requests to my internal web server if they look OK (URL within reasonable size limits, doesn't have any strange characters, no weird headers, that kind of thing). * Logs my current IP address to a remote server with a fixed IP address whenever it changes, so that that server can forward SMTP and/or web connections to it whenever it receives them.
Without support for Windows 98, what will users with limited-capability computers (e.g., computers equipped with 300-MHz processors) do?
Err... install XP on them? I'm running it on a 400 MHz machine here, and it works just fine. If you have less than 128 MB of RAM you may need to fine tune its memory usage (i.e. stop all the useless services from running), and you'll probably need to switch off all the fancy display effects, but it should work just as acceptably as Win98 does on such hardware. My experience of upgrading was that XP performed better on this machine than 98 did.
There are other breeds with similar attributes, too. But note that there is more than one allergen in cat fur, so while this works for some people, others might not get the benefit.
These are just supercapacitors [...] not new [...] poor energy density compared to chemical technologies
RTFA. They're a new design of supercapacitor which has higher energy density. Linked documents quote 60Wh/kilo, which is better than many chemical technologies that are in use today.
A value of 60Wh/kg (is this gravimetric charge density?) is less than lead-acid.
Perhaps. But totally discharging your capacitor won't render it inoperable, so you get to use all of that power, not just some of it like you would with lead acids.
He doesn't say it will replace the main battery of a hybrid car.
He doesn't say it won't. But if you look at the info posted elsewhere, the claims are energy densities similar to batteries (60 Wh per kilo, which is comparable to lead acids) and insane numbers of discharge cycles (300,000).
The cost of replacing batteries is a significant proportion of the maintenance costs of an hybrid vehicle. It's the largest part of the running cost of a pure electrical vehicle. This technology promises to extend battery lifetime by a factor of 30. That's going to be a big saving for EV owners, assuming the cost of the caps isn't too high.
Yeah, but due to the high density, these might have a higher leakage current.
But in the end, does it matter that much? Most people will use their cars daily. Throw a lead-acid in as backup to keep a partial charge when you leave it for a while, and everything should work.
searching for big capacitors on froogle, I came up with a link from Autotoys for a 1 Farad capacitor, on sale for a mere $42
Uh... the reason these capacitors are so expensive is because they're being sold to the car-modding community, who are generally willing to pay over-the-odds for something that looks flash. I bet they have blue leds and voltage displays on them. Capacitors sold for other purposes are generally cheaper.
As an example, this 10 farad 2.5v capacitor provides around a third the charge-holding capacity for roughly a tenth of the price.
you'd need a TON to power a car for an hour.. 100 HP = 75kW, for an hour, that's 270 MJ
Uh-huh.
1 - most cars don't need anything like 75kW. My old Ford Escort has a 56 kW engine and moves more than adequately. A small car (e.g. a Smart) would need substantially less.
2 - most people don't drive with their foot flat to the floor most of the time.
3 - electric motors have a much flatter torque response than internal combustion engines, which typically only provide half their maximum possible power at their normal operating point (you have to redline them on the gear changes to get best performance). Electric cars typically outperform internal combustion driven cars with much larger engines.
4 - a capacitor powered car would probably be better at regenerative braking than a battery powered one, so would need less charge overall anyway.
I was going to write here about how Britain's going the same way... but a little digging showed up that the number of claims made droped by 5% between 2000 and 2005, despite a large increase in the number of people who believed more people were suing than before.
Our perception of the US situation is probably just as skewed as that public perception of the UK situation. Americans I've talked to seem no more likely to have been involved in litigation than Brits. I think its a media thing.
The key advantage of using a JIT compiler to perform optimisation is that you can perform optimisations that only work under conditions that are not provably true, and then undo the optimisation if it later turns out to be false. In your example, the JVM could do that, as long as it ensures that if such a subclass is loaded the optimised method is invalidated and recompiled before next use. See the description of the Java HotSpot JIT here:
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
Attributes were added to the language in version 1.5. You can now mark your classes and methods with arbitrary attributes, which individual compilers and runtime environments are free to interpret however they wish.
if zope is so great then how come there are only three or four blogs written for it and not one of them is 1/10th as good as wordpress which is written in PHP? How come not one ticket tracker written in zope is 1/10th as good as eventum written in php?
You might think you know the answer, but you're wrong. The real answer is very obvious. It is this: zope has a low installed base at ISPs. Perhaps this is because PHP is easier than Zope, I don't know. I suspect it's just because more people use PHP because more people have tried PHP, and that's because PHP is what *everyone* knows is what you use for writing simple web applications (either that or ASP). More complex apps? Java servlets, or ISAPI extensions. If you're a hacker? mod_perl.
This is common wisdom, so this is what people do. So this is what the ISPs support.
Seriously, that's the reason. I'm currently working on a major web application in PHP. Would I rather be doing it in Python? Sure; it's a much better language, much cleaner syntax, does everything I need it to more effeciently than PHP does. So why am I using PHP? Because I want portability between as many ISPs as I can feasibly arrange, and when I ask ISPs if they have Python/Apache mod_python installed, most of the ones in the price range I'm targetting say they don't. All of the ones in my price range can support PHP. About a third of them can support ASP.
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.
What few people seem to have realised is that the best way of achieving cross platform portability is not to throw out the systems you're porting to and implement everything from scratch (the AWT/SWING approach). This just results in applications that feel wrong whichever system you run them on. The answer is to use native widgets in a way that is flexible enough to allow the toolkit to decide look & feel issues rather than the programmer. Sure, it's a little harder to write for (you'll probably find yourself doing stuff like writing an XML definition of how the interface should work rather than directly manipulating controls, which is a little more abstract and maybe a little harder to work with if you're aiming for something other than trivial interactions), but the results are so much better that in most cases it's worth the tiny extra effort involved.
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.)
As I'm currently working on a PHP project that's about to hit 8,000 lines of code and is showing no signs of stopping that upward climb in the near future, I understand most of your concerns. But none of them are killers.
You should be aware, BTW, that closures can be simulated quite easily in PHP, as they can in any dynamic language that supports 'eval' thus:(I leave handling of function parameters as an exercise to the reader; it's fairly straightforward, but detracts from the readability of the example)
If your native code is running as slow as interpreted, I would really recommend getting that looked at.
The question you have to ask, of course, is where is the bottleneck. And the answer is fairly obvious if you analyse the performance of modern applications on a variety of different hardware: IO is the bottleneck in almost every case. There's no other explanation for why my 400MHz desktop (with a nice, fast hard disk) performs as well as or better than my 1.7GHz laptop (with a slow, energy saving hard disk but otherwise similar specs) for many applications (including Firefox, OpenOffice, etc... the kind of things that the average user runs daily) while the laptop wipes the floor with it for others (media players, SketchUp).
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. 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.
In the end, fast programs are about good design, not language choice. Higher level languages often allow you to spend more time on design and less on implementation. All real-world projects have a limited time scale; ISVs just try to do the best they can with the time they have available, which isn't usually producing something miraculous.
It takes a special kind of brilliance to write a debugger---one that I certainly will never have---and I admire him for doing such great and valuable work.
I'm not sure I follow you. In what way is a debugger harder than (say) a compiler?
Just a point of information: the French Prime Minister (Dominique de Villepin) is not a head of state. That position is reserved for the President (Jacques Chirac).
Until you hit a 32bit operation it ran fine.
I developed a 32-bit protected mode operating system kernel with multitasking and memory protection on a 386 SX 40. 386 SXs can run 32 bit operations fine.
Not just that, if you look through the pages there are about 20 videos in them that are all people singing this song. WTF?
I guess Mr. Jamieson (if that is his real name..) forgot that other manufacturers could choose to offer non-drm'd .mp3 files which would work on the iPod, and any other mp3 player on the planet.
I think what he's aiming at is more the ability to download from iTMS and play on a non-apple device.
That's an ... err ... interesting article. I was right with them until they said:
"This experiment proved that electric batteries were used some 1,800 years before their modern invention by Alessandro Volta in 1799."
Err... no, it doesn't. At the most it proves that somebody made a battery in a 2,000 year old pot at some point during that pot's lifetime. I'm figuring it's more likely to be entirely coincidental, and there's nothing there that doesn't.
"Iraq has a rich national heritage. The Garden of Eden and the Tower of Babel are said to have been sited in this ancient land."
How about the Hanging Gardens of Babylon, which are at least widely acknowledged to have existed, as opposed to the two examples they cite which are probably purely mythological?
> Ok, you do REALIZE that a 386 processor is 32bit?
The 386SX was designed for systems designers who were looking for 386 capabilities at 286 system prices. Like the 286, the 386SX is restricted to only 16 bits when communicating with other system components, such as memory. What part of 386sx did you not read in my orginal post?
The 386SX is internally identical to the 386DX. Programming it is identical. It has 32 bit registers and uses 32 bit addressing. It is a 32 bit processor.
It sits on a 16 bit bus. This is a hardware interface issue only. If this makes the 386SX a 16 bit processor, then the Pentium is a 64 bit processor.
You should have asked how I got Win95 running on a 386sx because the installer won't run.
By installing it on a DX and then switching the disk to another machine? Only stuff that specifically checks for an SX won't run on an SX. It might be embarassingly slow, but it'll run.
Because you might want your router to do something that that $30 hardware router (and where do you get one that cheap, BTW?) can't.
For example, mine currently:
* Has a store & forward SMTP daemon that scans my incoming mail for viruses and junk before forwarding it to my main SMTP server.
* Runs a web request sanitiser that forwards requests to my internal web server if they look OK (URL within reasonable size limits, doesn't have any strange characters, no weird headers, that kind of thing).
* Logs my current IP address to a remote server with a fixed IP address whenever it changes, so that that server can forward SMTP and/or web connections to it whenever it receives them.
Without support for Windows 98, what will users with limited-capability computers (e.g., computers equipped with 300-MHz processors) do?
Err... install XP on them? I'm running it on a 400 MHz machine here, and it works just fine. If you have less than 128 MB of RAM you may need to fine tune its memory usage (i.e. stop all the useless services from running), and you'll probably need to switch off all the fancy display effects, but it should work just as acceptably as Win98 does on such hardware. My experience of upgrading was that XP performed better on this machine than 98 did.
There are other breeds with similar attributes, too. But note that there is more than one allergen in cat fur, so while this works for some people, others might not get the benefit.
The article suggests you want the DMFC variety. I guess the "Standard" MEA you've linked here would need gaseous hydrogen/oxygen mix to function?
These are just supercapacitors [...] not new [...] poor energy density compared to chemical technologies
RTFA. They're a new design of supercapacitor which has higher energy density. Linked documents quote 60Wh/kilo, which is better than many chemical technologies that are in use today.
A value of 60Wh/kg (is this gravimetric charge density?) is less than lead-acid.
Perhaps. But totally discharging your capacitor won't render it inoperable, so you get to use all of that power, not just some of it like you would with lead acids.
He doesn't say it will replace the main battery of a hybrid car.
He doesn't say it won't. But if you look at the info posted elsewhere, the claims are energy densities similar to batteries (60 Wh per kilo, which is comparable to lead acids) and insane numbers of discharge cycles (300,000).
The cost of replacing batteries is a significant proportion of the maintenance costs of an hybrid vehicle. It's the largest part of the running cost of a pure electrical vehicle. This technology promises to extend battery lifetime by a factor of 30. That's going to be a big saving for EV owners, assuming the cost of the caps isn't too high.
Yeah, but due to the high density, these might have a higher leakage current.
But in the end, does it matter that much? Most people will use their cars daily. Throw a lead-acid in as backup to keep a partial charge when you leave it for a while, and everything should work.
searching for big capacitors on froogle, I came up with a link from Autotoys for a 1 Farad capacitor, on sale for a mere $42
Uh... the reason these capacitors are so expensive is because they're being sold to the car-modding community, who are generally willing to pay over-the-odds for something that looks flash. I bet they have blue leds and voltage displays on them. Capacitors sold for other purposes are generally cheaper.
As an example, this 10 farad 2.5v capacitor provides around a third the charge-holding capacity for roughly a tenth of the price.
you'd need a TON to power a car for an hour.. 100 HP = 75kW, for an hour, that's 270 MJ
Uh-huh.
1 - most cars don't need anything like 75kW. My old Ford Escort has a 56 kW engine and moves more than adequately. A small car (e.g. a Smart) would need substantially less.
2 - most people don't drive with their foot flat to the floor most of the time.
3 - electric motors have a much flatter torque response than internal combustion engines, which typically only provide half their maximum possible power at their normal operating point (you have to redline them on the gear changes to get best performance). Electric cars typically outperform internal combustion driven cars with much larger engines.
4 - a capacitor powered car would probably be better at regenerative braking than a battery powered one, so would need less charge overall anyway.
Wikipedia cites the OED, unfortunately you have to pay to see it online.
http://en.wikipedia.org/wiki/Duck_tape
Where'd you get $47.50? Looking at the site recommended in TFA, the part (here) costs $69.50.
I was going to write here about how Britain's going the same way... but a little digging showed up that the number of claims made droped by 5% between 2000 and 2005, despite a large increase in the number of people who believed more people were suing than before.
Our perception of the US situation is probably just as skewed as that public perception of the UK situation. Americans I've talked to seem no more likely to have been involved in litigation than Brits. I think its a media thing.