On Mon, 2006-12-04 at 17:37 -0200, Mark Boon wrote: > > On 4-dec-06, at 15:23, Don Dailey wrote: > > > But it seems like more of a travesty in Java. > > > > > Well, this may be subjective. What may seem like travesty to one may > appear completely normal to someone else. > > > I'm curious though. If you have the time, could you point out in the > code in my public project or in my earlier public library where my > highly optimized Java code seems like a travesty to you. Personally I > can't think of any, especially when compared to C, but as I said that > may be highly subjective.
This isn't a Java issue, it's most if not all computer languages - if you really go all out to optimize your code for performance, you will sacrifice readability, clarity, etc. Without looking at your code I would say that if it's extremely easy to read and clear and beautiful, it's not as optimized as you think. If it's highly optimized and efficient, it's probably not as beautiful and readable as you think. > Then again, I almost purely focus on algorithmic optimizations. Most > other optimizations are temporary. They either become obsolete or the > compiler does them for you after a while. So in the long run I think > those optmizations are a waste of time. Which does not mean I'd not > revert to them from time to time if I think it's important enough in > the short term (like making a program playing fast enough to meet a > certain time-constraint.) I've never understood that reasoning. If you are willing to wait for a better compiler to come along, fine. But to say optimizations are a waste of time because a better compiler will come along someday isn't the point we are talking about. You could also claim that ANY optimization is a waste of time because if you wait long enough computers will get faster and get you up to the desired level of performance. The only problem with that reasoning is that you will always be slower than you have to be. If it's important to you to be competitive with other programs, you will always be behind - at least with the computer hardware speed issue. However I do agree with you to a point. If I knew a particular compiler optimization is likely to happen in the near future, I probably wouldn't bother unless it was a major problem right now. For me, here is the point: If you use anything other than C (or assembler) you are starting with a speed penalty, a handicap. Presumably, the only reason you would do this, is for the convenience of a higher level language - a logical and sensible trade-off that I have no problem with. But then you spend a lot of time optimizing it because it's not as fast as C. You started with Java to save yourself a lot of time and increase your productivity, then you give it all back trying to overcome the speed handicap you accepted! Once you make the decision of a higher level language, you have accepted the tradeoff of lower performance for higher programmer productivity. You have implicitly admitted, by choosing Java or some high level language, that you don't need to be on the cutting edge of performance. So my question is why not just wait for a faster computer or better optimizer and maintain the advantages of using a higher level languages? I don't have a problem with basic and sensible optimizations that may even increase the readability of the code, but people here are talking about going out of their way to avoid creating objects and such. This just doesn't make sense to me. This is something you would do in C because you are performance guru freak. - Don > Mark > > > > _______________________________________________ > computer-go mailing list > computer-go@computer-go.org > http://www.computer-go.org/mailman/listinfo/computer-go/ _______________________________________________ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/