I’m aware that Flash’s VM still can’t touch Java’s. For Flash 8 there was at least a 10x performance lag versus Java when I checked; I think 9 is closer, but still quite a ways off. So I’m not saying that the performance is there yet. But it’s getting closer, and Flash just seems like it’s being developed in a much more flexible manner than Java. The past two versions of Actionscript have each seriously broken code from the previous versions, to the point that you’re essentially learning a new language. I see absolutely no pandering to the pathetic lower 10% of programmers when design decisions are made regarding Actionscript, whereas Java’s evolution is almost completely determined by the fact that too many Java programmers suck at programming to add much complexity to the language.
For instance, this whole stack allocation thing has one extremely simple solution. Forget escape analysis, just allow classes or structs with value semantics - this has been suggested a thousand times for a thousand reasons. If you can never pass a pointer or a reference, then BAM!, the thing can never escape, so you can safely allocate it to the stack. Easy to implement, proven to work (built-in types prove this). But no. As Sun sees it, any possible means of declaring and manipulating a value type is far too complex for the rubes that program Java, so the idea gets flushed every time it’s brought up.
I’m not saying this is totally a bad move on Sun’s part. It probably lessens the overall amount of whining that they hear, especially given that their installed base contains a whole lot of terrible programmers (banks are filled with them) that really would have trouble learning another syntax element or compiler hint. But it does mean that the language becomes a haven for that type of programmer, and the rest of us have to live without certain features that would really help us.
From what I can see, Flash’s performance is currently bottlenecked at the development level - they are working hard to improve, but it takes a lot of work. They just got a JIT compiler in, so they still have a lot of catch up to do, and we have no idea how far they’ll take it. But Java’s performance is quite often bound by choice, not development time. Many of the reasons it is slower than native code could be addressed in relatively easy to implement ways, at the cost of changing pieces of the language, breaking code, or making people learn new syntax. Which they are extremely hesitant (justifiably or otherwise) to do. Maybe it’s naive to expect Flash to ultimately win out, but unless Adobe starts pandering to their lower 10% more than they do now I don’t think it’s completely out of the question.