I'm writing some code that uses a triplet of integers which new integers are created fairly often. Currently I have them written as a class with 3 elements. This makes it really easy to use and easier to understand. However, I don't know what the creation of this small class actually encumbers, and I don't know how much extra garbage collection it creates. So I've come up with a clever alternative, where instead of using a class, I just use a single integer. I know each of the 3 ints will be small ranges, and will fit in 2 digits, so I figured I could use a 6 digit number and use divisions to separate them. This code seems like it would take less memory and time to implement, though it's much harder to understand -- should I not look at it for 6 months, I might not remember what the hell I was doing. Of course I can always comment away and hope it's understandable later. So, if these triplets are created often enough, is it really worth it to make the code a little more complicated?

determine what is slowest machine you want your game to be able to run on, find that machine and try to run it if your game is too slow, profile it with some profiler, netbeans profiler is said to be the best.

Ok, I think I'll just leave it how it is. Really was trying to figure out if constantly creating this class of 3 ints was creating a lot of extra overhead, but since nobody jumped out and said "holy crap that's the most inefficient thing I've ever heard!", I imagine it's not going to cause a problem. Thanks.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org