Fast enums?

Put your problem here if it does not fit any of the other categories.

Fast enums?

Postby Skiller » Mon Jan 10, 2011 12:55 am

I been struggling with performance issues in my app, it's a port from some VERY fast C++ code but it used enums extensively. As you might have guessed after some profiling I found that a ridiculous amount of time was spent using the Java enums, so much so that what was taking me 20ish seconds with enums is now taking less than 2 with static final ints.

So given that Java has royally raped enums to the point of being unusable, is there anything else in Java that works the same as C++ enums? Or is there a pre-processor in Java that I could use to make macros to create pseudo enums?

I have several enums with over 50 values in each and it scares me how unsafe and time consuming it would be to have to manually convert them all to static final ints :(
Posts: 33
Joined: Sun Nov 28, 2010 8:35 pm
Location: Australia


Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 15 guests