为什么“避免只需要整数的枚举"?从Android的性能提示中删除? [英] Why was "Avoid Enums Where You Only Need Ints" removed from Android's performance tips?

查看:12
本文介绍了为什么“避免只需要整数的枚举"?从Android的性能提示中删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从官方开发人员文档.(请参阅 为什么 Android 不使用更多枚举? 了解旧部分内容)

The section "Avoid Enums Where You Only Need Ints" was removed from the official developer documentation. (See Why doesn't Android use more enums? for the old section content)

为什么?Android VM 中是否有更改导致提示过时?

Why? Was there a change in the Android VM that made the tip obsolete?

推荐答案

Elliot Hugues 2011 年的回答说避免枚举的最初原因是出于性能原因......就像在处理性能"中一样.由于这个理由没有事实根据,所以从官方文档中删除了.

The 2011 answer from Elliot Hugues said that the original reason to avoid enum was for performance reason... as in "processing performance". As this reason was not backed by fact, it was removed from the official documentation.

后来添加了它,因为枚举在内存中添加的数据比使用整数要多得多.

It has been added later on because enums add a lot more data in memory than using integer.

这篇关于为什么“避免只需要整数的枚举"?从Android的性能提示中删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆