4 ms·
The cost of Java's EnumSet – A criticism of the ecosystem
- Hackbraten 5y agoI wonder whether that performance penalty would actually affect a real-world application in a way the user would notice.
- brundolf 5y agoIt being something this fundamental, it's almost inevitable that some application out there is meaningfully impacted by this difference. Maybe not yours - and indeed, I wouldn't step down into the int version without a benchmark showing that it's a problem in my specific case - but it's not hard to imagine cases where this would have a huge impact. But even setting that aside: I think the author's point was less that you should never use EnumSet, and more that the very fact that it exists is an illustration of the flaws at the language's core.
- barbarbar 5y agoA very good example of premature optimization since there is no actual problem. It would be better to start with a real problem and then if it turned out this was a problem then use the int approach.