- Joined
- May 30, 2013
- Messages
- 288
- Reaction score
- 242
Re: Kepler - Habbo Hotel v14+ server (BattleBall, Camera, Trax, Rollers) [Java]
From a runtime perspective it's different however. The JVM can optimize a boolean to a single bit, where as an enum would require a heap of objects.
From a storage point of view, both boolean/tinyint(1) and enum(online,offline) take up one byte.I'm personally an advocate for clarity / readable code over micro optimizations.
That said, enum values are stored in a single byte (for up to 255 entries), 2 bytes for more etc. They are not stored as string values for every entry.
You got more issues on your hands if a couple MB at most for a big hotel is what you're trying to safe on diskspace.
From a runtime perspective it's different however. The JVM can optimize a boolean to a single bit, where as an enum would require a heap of objects.