Class and array

Fair enough, but you should take a different approach:

  • benchmark your code - maybe it’s just fast enough
  • profile your code to find bottlenecks (Use one of Netbeans, Yourkit, Visual VM, JProfiler etc.)

Use the result of the Profiler to

  • replace components that are slow for your use case with fast ones - usually every component has strengths and weaknesses
  • reduce “exponential” complexities (like nested loops)
  • find another algorithm to do things that are slow (google is your friend:))

Usually performance problems exist on a completely different level than such micro-optimizations

Ah, through composure instead. Yeah, that works.

I actually used this method myself once in a library made. I also went further and wrapped an array instead of an ArrayList and then just resize it myself. There is a speed improvement, but the only real improvement you see if you also do this for primitive types.

However I added this to my own code a long time after writing it (not in the first case), I did need my library to run faster (you shouldn’t optimize unless it’s needed) and it’s only seen internally. I’d maintain you should only ever optimize under those circumstances.

Considering that the original poster needed help on just how to use arrays; this kind of stuff is too advanced (and it’s to early on in his code) to be suggesting.

I will agree with you. On JGO, I often get a little bit too academic about things. As I said above, I have never personally done this in any “actual” projects, because they are never my bottleneck.

I usually associate academic with fully thought through

This is just condescending and ill informed.

Hm… I was thinking academic more referring to talking over ideas and coming to a conclusion, but yes you’re right in many cases I don’t think an overly long time about what I’m saying. As for the condescension, it wasn’t at all intended. And I don’t think that was ill informed either. I just searched the forum for “generics” in posts by kevglass.

http://www.java-gaming.org/index.php/topic,8132.msg71311.html#msg71311

[quote]one of the benefits of not using generics, ick!
[/quote]
http://www.java-gaming.org/index.php/topic,6441.msg57663.html#msg57663

[quote]I don’t like generics
[/quote]
http://www.java-gaming.org/index.php/topic,6164.msg56424.html#msg56424

[quote]They’re easy to misuse
[/quote]
http://www.java-gaming.org/index.php/topic,7180.msg63294.html#msg63294

[quote]Just don’t use generics. They’re a move toward bad programming anyway
[/quote]
Now, I’m posting all this just to emphasize the impression I got from Kev, and not that I was trying to throw out wild opinions about what someone else thinks (which admittedly I am still doing to some extent). I will also be the first to point out that in many of the posts I quoted Kev’s main point is not that generics themselves are bad, but that they allow programmers to do dumb things. So he doesn’t like generics because of different reasons than I mentioned.

All that said, though, I am totally aware that I too often will evangelize a point I remember reading on this very forum, but I turn out to be mistaken. I get carried away with the interest of having a discussion. I will continue to try not to discuss something as an informed individual unless I do in fact know something about the subject from my own experiences. I will also point out that my skill as a software engineer has never lied in a deep knowledge of the compiler or the OS or anything like that as your knowledge is based in, Riven, but it is in making programs come together quickly and cleanly in an intelligent fashion. I usually only worry about the underlying mechanics of what I’m using if I need to know them. So, like I already said, I should probably stop giving advice about underlying mechanics and stick to giving advice about making games.

I (obiously) disagreed with bits, but I didn’t think there was nothing wrong with your suggestion. You certainly shouldn’t feel like you shouldn’t make suggestion in an area.

Cool. I’ve just gotten burned one too many times for suggesting/saying something that wasn’t completely correct.